Commit f33c4049 authored by Liu Peng's avatar Liu Peng

调整页面样式

parent 97a90acd
...@@ -37,14 +37,12 @@ ...@@ -37,14 +37,12 @@
<template slot="action" slot-scope="text, record"> <template slot="action" slot-scope="text, record">
<a-button <a-button
icon="edit" icon="edit"
type="primary" type="link"
class="btn_margin"
@click="showModal(record)" @click="showModal(record)"
>编辑</a-button> >编辑</a-button>
<a-button <a-button
icon="delete" icon="delete"
type="danger" type="link"
class="btn_margin"
@click="deleteRow({record})" @click="deleteRow({record})"
>删除</a-button> >删除</a-button>
</template> </template>
...@@ -118,7 +116,8 @@ let columns = [ ...@@ -118,7 +116,8 @@ let columns = [
title: "操作", title: "操作",
key: "action", key: "action",
scopedSlots: { customRender: "action" }, scopedSlots: { customRender: "action" },
align: "center" align: "center",
width: 180,
} }
]; ];
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
</a-button-group> </a-button-group>
</div> </div>
<div> <div>
<a-row> <a-row type="flex" justify="space-between">
<a-col :span="4" class="col-h"> <a-col :span="4" class="col-h">
<a-tree <a-tree
:treeData="menuTreeData" :treeData="menuTreeData"
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
showLine showLine
/> />
</a-col> </a-col>
<a-col :span="10"> <a-col :span="16">
<a-form :form="modalForm" @submit="modalHandleSubmit"> <a-form :form="modalForm" @submit="modalHandleSubmit">
<a-form-item <a-form-item
label="父级名称" label="父级名称"
...@@ -77,6 +77,8 @@ ...@@ -77,6 +77,8 @@
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-col> </a-col>
<a-col :span="4"/>
</a-row> </a-row>
</div> </div>
</div> </div>
......
...@@ -21,33 +21,44 @@ ...@@ -21,33 +21,44 @@
rowKey="id" rowKey="id"
@change="handleTableChange" @change="handleTableChange"
> >
<template slot="action" slot-scope="text, record"> <template
slot="action"
slot-scope="text, record"
>
<a-button <a-button
icon="edit" icon="edit"
type="primary" type="link"
class="btn_margin"
@click="showModal(record)" @click="showModal(record)"
>编辑</a-button> >编辑</a-button>
<a-button <a-button
icon="delete" icon="delete"
type="danger" type="link"
class="btn_margin"
@click="deleteRow(record)" @click="deleteRow(record)"
>删除</a-button> >删除</a-button>
<a-button <a-button
icon="cluster" icon="cluster"
type="link" type="link"
class="btn_margin"
@click="menuAuthModal(record)" @click="menuAuthModal(record)"
>菜单权限</a-button> >菜单权限</a-button>
</template> </template>
</a-table> </a-table>
</div> </div>
<!-- 添加及编辑弹窗 --> <!-- 添加及编辑弹窗 -->
<a-modal :title="modalTitle" v-model="modalVisible" :footer="null"> <a-modal
<a-form :form="modalForm" @submit="modalHandleSubmit"> :title="modalTitle"
v-model="modalVisible"
:footer="null"
>
<a-form
:form="modalForm"
@submit="modalHandleSubmit"
>
<a-form-item label="角色名称" :label-col="{ span: 5 }" :wrapper-col="{ span: 19 }"> <a-form-item
label="角色名称"
:label-col="{ span: 5 }"
:wrapper-col="{ span: 19 }"
>
<a-input <a-input
v-decorator="[ v-decorator="[
'name',{rules: [{required: true, message: '角色名称不能为空'}]} 'name',{rules: [{required: true, message: '角色名称不能为空'}]}
...@@ -55,7 +66,11 @@ ...@@ -55,7 +66,11 @@
placeholder="请输入角色名称" placeholder="请输入角色名称"
/> />
</a-form-item> </a-form-item>
<a-form-item label="角色代码" :label-col="{ span: 5 }" :wrapper-col="{ span: 19 }"> <a-form-item
label="角色代码"
:label-col="{ span: 5 }"
:wrapper-col="{ span: 19 }"
>
<a-input <a-input
v-decorator="[ v-decorator="[
'code',{rules: [{required: true, message: '角色代码不能为空'}]} 'code',{rules: [{required: true, message: '角色代码不能为空'}]}
...@@ -65,7 +80,10 @@ ...@@ -65,7 +80,10 @@
</a-form-item> </a-form-item>
<a-form-item :wrapper-col="{ span: 19, offset: 5 }"> <a-form-item :wrapper-col="{ span: 19, offset: 5 }">
<a-button type="primary" html-type="submit">保存</a-button> <a-button
type="primary"
html-type="submit"
>保存</a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-modal> </a-modal>
...@@ -85,7 +103,10 @@ ...@@ -85,7 +103,10 @@
@check="this.onMenuCheck" @check="this.onMenuCheck"
/> />
<div class="btn-box"> <div class="btn-box">
<a-button type="primary" @click="saveMenu">保存</a-button> <a-button
type="primary"
@click="saveMenu"
>保存</a-button>
</div> </div>
</a-modal> </a-modal>
...@@ -99,32 +120,38 @@ import { ...@@ -99,32 +120,38 @@ import {
fetchList, fetchList,
putObj, putObj,
fetchRoleMenuIds, fetchRoleMenuIds,
permissionUpd permissionUpd,
} from "@/api/admin/role"; } from "@/api/admin/role";
import { fetchMenuTree } from "@/api/admin/menu"; import { fetchMenuTree } from "@/api/admin/menu";
import { disposereq } from "@/utils/util"; import { disposereq, timestampToTime } from "@/utils/util";
let columns = [ let columns = [
{ {
title: "角色名称", title: "角色名称",
dataIndex: "name", dataIndex: "name",
align: "center" align: "center",
}, },
{ {
title: "角色代码", title: "角色代码",
dataIndex: "code", dataIndex: "code",
align: "center" align: "center",
}, },
{ {
title: "创建时间", title: "创建时间",
dataIndex: "createTime", dataIndex: "createTime",
align: "center" align: "center",
width: 180,
customRender: (text, record) => {
return timestampToTime(text);
},
}, },
{ {
title: "操作", title: "操作",
key: "action", key: "action",
scopedSlots: { customRender: "action" }, scopedSlots: { customRender: "action" },
align: "center" align: "center",
} width: 300,
},
]; ];
export default { export default {
...@@ -135,16 +162,16 @@ export default { ...@@ -135,16 +162,16 @@ export default {
searchPage: { searchPage: {
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
name: "" name: "",
}, },
columns: columns, columns: columns,
data: [], data: [],
pagination: { pagination: {
showQuickJumper: true, showQuickJumper: true,
showSizeChanger: true showSizeChanger: true,
}, },
modalVisible: false, modalVisible: false,
modalTitle: '添加', modalTitle: "添加",
modalForm: this.$form.createForm(this, { name: "coordinated" }), modalForm: this.$form.createForm(this, { name: "coordinated" }),
rowData: {}, rowData: {},
menumodalVisible: false, menumodalVisible: false,
...@@ -154,9 +181,9 @@ export default { ...@@ -154,9 +181,9 @@ export default {
menuReplaceFields: { menuReplaceFields: {
children: "children", children: "children",
title: "name", title: "name",
key: "id" key: "id",
}, },
tmpMenuIds: [] tmpMenuIds: [],
}; };
}, },
// 创建完毕 // 创建完毕
...@@ -165,14 +192,12 @@ export default { ...@@ -165,14 +192,12 @@ export default {
this.GetAllMenu(); this.GetAllMenu();
}, },
// 即将更新渲染 // 即将更新渲染
beforeUpdate() { beforeUpdate() {},
},
methods: { methods: {
// 获取角色 // 获取角色
getList(pageData) { getList(pageData) {
fetchList(pageData) fetchList(pageData)
.then(res => { .then((res) => {
this.loading = false; this.loading = false;
if (res.code == 200) { if (res.code == 200) {
this.data = res.data; this.data = res.data;
...@@ -184,14 +209,14 @@ export default { ...@@ -184,14 +209,14 @@ export default {
this.$message.info(res.resp_msg); this.$message.info(res.resp_msg);
} }
}) })
.catch(err => { .catch((err) => {
this.$message.info(err); this.$message.info(err);
}); });
}, },
// 获取所有菜单 // 获取所有菜单
GetAllMenu() { GetAllMenu() {
fetchMenuTree() fetchMenuTree()
.then(res => { .then((res) => {
if (res.resp_code == 200) { if (res.resp_code == 200) {
// console.log(res.datas) // console.log(res.datas)
this.menuTreeData = res.datas.roots; this.menuTreeData = res.datas.roots;
...@@ -201,26 +226,28 @@ export default { ...@@ -201,26 +226,28 @@ export default {
this.$message.info(res.resp_msg); this.$message.info(res.resp_msg);
} }
}) })
.catch(err => { .catch((err) => {
this.$message.info(err); this.$message.info(err);
}); });
}, },
// 获取选中菜单 // 获取选中菜单
GetCheckMenu(roleId) { GetCheckMenu(roleId) {
fetchRoleMenuIds(roleId) fetchRoleMenuIds(roleId)
.then(res => { .then((res) => {
// console.log(this.tmpMenuIds) // console.log(this.tmpMenuIds)
this.allMenuCheckedKeys = res.datas this.allMenuCheckedKeys = res.datas;
let result = [...new Set(this.tmpMenuIds)].filter((item) => new Set(eval(res.datas)).has(item)); let result = [...new Set(this.tmpMenuIds)].filter((item) =>
new Set(eval(res.datas)).has(item)
);
// console.log(result) // console.log(result)
this.menuDefaultCheckedKeys = result this.menuDefaultCheckedKeys = result;
this.menumodalVisible = true; this.menumodalVisible = true;
}) })
.catch(err => { .catch((err) => {
this.$message.info(err); this.$message.info(err);
}); });
}, },
deepList(data){ deepList(data) {
data.map((item) => { data.map((item) => {
if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
this.deepList(item.children); this.deepList(item.children);
...@@ -250,36 +277,35 @@ export default { ...@@ -250,36 +277,35 @@ export default {
this.modalVisible = true; this.modalVisible = true;
// 判断添加或者编辑 // 判断添加或者编辑
if (row == "") { if (row == "") {
this.modalTitle = '添加'; this.modalTitle = "添加";
this.modalType = "add"; this.modalType = "add";
this.$nextTick(() => { this.$nextTick(() => {
this.modalForm.setFieldsValue({ this.modalForm.setFieldsValue({
name: "", name: "",
code: "" code: "",
}); });
}); });
} else { } else {
this.modalTitle = '编辑'; this.modalTitle = "编辑";
this.modalType = "edit"; this.modalType = "edit";
this.$nextTick(() => { this.$nextTick(() => {
this.modalForm.setFieldsValue({ this.modalForm.setFieldsValue({
name: row.name, name: row.name,
code: row.code code: row.code,
}); });
this.rowData = row; this.rowData = row;
}); });
} }
}, },
// 删除行数据 // 删除行数据
deleteRow(row) { deleteRow(row) {
console.log(row) console.log(row);
delObj([row.id]) delObj([row.id])
.then(res => { .then((res) => {
this.loading = false; this.loading = false;
if (res.resp_code == 200) { if (res.resp_code == 200) {
this.$message.success('删除成功'); this.$message.success("删除成功");
const searchPage = { ...this.searchPage }; const searchPage = { ...this.searchPage };
this.loading = true; this.loading = true;
this.getList(searchPage); this.getList(searchPage);
...@@ -287,7 +313,7 @@ export default { ...@@ -287,7 +313,7 @@ export default {
this.$message.info(res.resp_msg); this.$message.info(res.resp_msg);
} }
}) })
.catch(err => { .catch((err) => {
this.$message.info(err); this.$message.info(err);
}); });
}, },
...@@ -298,10 +324,10 @@ export default { ...@@ -298,10 +324,10 @@ export default {
if (!err && this.modalType == "add") { if (!err && this.modalType == "add") {
// console.log(values) // console.log(values)
addObj(values) addObj(values)
.then(res => { .then((res) => {
if (res.resp_code == 200) { if (res.resp_code == 200) {
this.modalVisible = false; this.modalVisible = false;
this.$message.success('保存成功'); this.$message.success("保存成功");
const searchPage = { ...this.searchPage }; const searchPage = { ...this.searchPage };
this.loading = true; this.loading = true;
this.getList(searchPage); this.getList(searchPage);
...@@ -309,17 +335,17 @@ export default { ...@@ -309,17 +335,17 @@ export default {
this.$message.info(res.resp_msg); this.$message.info(res.resp_msg);
} }
}) })
.catch(err => { .catch((err) => {
this.$message.info(err); this.$message.info(err);
}); });
} else if (!err && this.modalType == "edit") { } else if (!err && this.modalType == "edit") {
this.rowData.name = values.name; this.rowData.name = values.name;
this.rowData.code = values.code; this.rowData.code = values.code;
putObj(this.rowData) putObj(this.rowData)
.then(res => { .then((res) => {
if (res.resp_code == 200) { if (res.resp_code == 200) {
this.modalVisible = false; this.modalVisible = false;
this.$message.success('保存成功'); this.$message.success("保存成功");
const searchPage = { ...this.searchPage }; const searchPage = { ...this.searchPage };
this.loading = true; this.loading = true;
this.getList(searchPage); this.getList(searchPage);
...@@ -327,7 +353,7 @@ export default { ...@@ -327,7 +353,7 @@ export default {
this.$message.info(res.resp_msg); this.$message.info(res.resp_msg);
} }
}) })
.catch(err => { .catch((err) => {
this.$message.info(err); this.$message.info(err);
}); });
} }
...@@ -346,20 +372,19 @@ export default { ...@@ -346,20 +372,19 @@ export default {
saveMenu() { saveMenu() {
// console.log(this.allMenuCheckedKeys) // console.log(this.allMenuCheckedKeys)
permissionUpd(this.roleId, this.allMenuCheckedKeys) permissionUpd(this.roleId, this.allMenuCheckedKeys)
.then(res => { .then((res) => {
if (res.resp_code == 200) { if (res.resp_code == 200) {
this.menumodalVisible = false; this.menumodalVisible = false;
this.$message.success('保存成功'); this.$message.success("保存成功");
} else { } else {
this.$message.info(res.resp_msg); this.$message.info(res.resp_msg);
} }
}) })
.catch(err => { .catch((err) => {
this.$message.info(err); this.$message.info(err);
}); });
}, },
},
}
}; };
</script> </script>
<style> <style>
......
...@@ -47,14 +47,13 @@ ...@@ -47,14 +47,13 @@
<template slot="action" slot-scope="text, record"> <template slot="action" slot-scope="text, record">
<a-button <a-button
icon="edit" icon="edit"
type="primary" type="link"
class="btn_margin" size="small"
@click="showModal(record)" @click="showModal(record)"
>修改</a-button> >修改</a-button>
<a-button <a-button
icon="delete" icon="delete"
type="danger" type="link"
class="btn_margin"
@click="deleteRow({record})" @click="deleteRow({record})"
>删除</a-button> >删除</a-button>
</template> </template>
...@@ -135,6 +134,7 @@ let columns = [ ...@@ -135,6 +134,7 @@ let columns = [
title: "状态", title: "状态",
dataIndex: "status", dataIndex: "status",
align: "center", align: "center",
width: '100px',
scopedSlots: { customRender: "statusFlag" } scopedSlots: { customRender: "statusFlag" }
}, },
{ {
...@@ -148,6 +148,7 @@ let columns = [ ...@@ -148,6 +148,7 @@ let columns = [
title: "创建时间", title: "创建时间",
dataIndex: "createTime", dataIndex: "createTime",
align: "center", align: "center",
width: '180px',
customRender: (text,record) => { customRender: (text,record) => {
return timestampToTime(text); return timestampToTime(text);
} }
...@@ -156,7 +157,8 @@ let columns = [ ...@@ -156,7 +157,8 @@ let columns = [
title: "操作", title: "操作",
key: "action", key: "action",
scopedSlots: { customRender: "action" }, scopedSlots: { customRender: "action" },
align: "center" align: "center",
width: '180px'
} }
]; ];
......
...@@ -77,14 +77,12 @@ ...@@ -77,14 +77,12 @@
<template slot="action" slot-scope="text, record"> <template slot="action" slot-scope="text, record">
<a-button <a-button
icon="edit" icon="edit"
type="primary" type="link"
class="btn_margin"
@click="navigateDetailPage(record)" @click="navigateDetailPage(record)"
>编辑</a-button> >编辑</a-button>
<a-button <a-button
icon="edit" icon="edit"
type="primary" type="link"
class="btn_margin"
@click="changeStatus(record)" @click="changeStatus(record)"
>{{record.status == 'UP' ? '下架' : '上架'}}</a-button> >{{record.status == 'UP' ? '下架' : '上架'}}</a-button>
</template> </template>
...@@ -120,7 +118,8 @@ let columns = [ ...@@ -120,7 +118,8 @@ let columns = [
title: '收费模式', title: '收费模式',
dataIndex: 'chargeModel', dataIndex: 'chargeModel',
align: 'center', align: 'center',
scopedSlots: {customRender: 'chargeModel'} scopedSlots: {customRender: 'chargeModel'},
width: 120,
}, },
{ {
title: '标签', title: '标签',
...@@ -132,13 +131,15 @@ let columns = [ ...@@ -132,13 +131,15 @@ let columns = [
title: '状态', title: '状态',
dataIndex: 'status', dataIndex: 'status',
align: 'center', align: 'center',
scopedSlots: {customRender: 'status'} scopedSlots: {customRender: 'status'},
width: 100,
}, },
{ {
title: '操作', title: '操作',
key: "action", key: "action",
scopedSlots: { customRender: "action" }, scopedSlots: { customRender: "action" },
align: "center" align: "center",
width: 180,
} }
] ]
export default { export default {
......
...@@ -4,10 +4,18 @@ ...@@ -4,10 +4,18 @@
<div class="search_box"> <div class="search_box">
<a-form layout="inline"> <a-form layout="inline">
<a-form-item label="标签名:"> <a-form-item label="标签名:">
<a-input v-model="searchPage.name" placeholder="请输入标签名" allowClear></a-input> <a-input
v-model="searchPage.name"
placeholder="请输入标签名"
allowClear
></a-input>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-button icon="search" type="primary" @click="handleSubmit">查询</a-button> <a-button
icon="search"
type="primary"
@click="handleSubmit"
>查询</a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
</div> </div>
...@@ -35,17 +43,18 @@ ...@@ -35,17 +43,18 @@
> >
<!-- 操作 --> <!-- 操作 -->
<template slot="action" slot-scope="text, record"> <template
slot="action"
slot-scope="text, record"
>
<a-button <a-button
icon="edit" icon="edit"
type="primary" type="link"
class="btn_margin"
@click="showModal(record)" @click="showModal(record)"
>修改</a-button> >修改</a-button>
<a-button <a-button
icon="delete" icon="delete"
type="danger" type="link"
class="btn_margin"
@click="deleteRow(record)" @click="deleteRow(record)"
>删除</a-button> >删除</a-button>
</template> </template>
...@@ -72,7 +81,10 @@ ...@@ -72,7 +81,10 @@
ref="nameVal" ref="nameVal"
prop="name" prop="name"
> >
<a-input v-model="formModel.name" @blur="blurValidate('nameVal')"></a-input> <a-input
v-model="formModel.name"
@blur="blurValidate('nameVal')"
></a-input>
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
...@@ -82,83 +94,84 @@ ...@@ -82,83 +94,84 @@
</template> </template>
<script> <script>
import {fetchList,addObj,putObj,delObj} from '@/api/biz/courseTag' import { fetchList, addObj, putObj, delObj } from "@/api/biz/courseTag";
import {disposereq} from '@/utils/util' import { disposereq } from "@/utils/util";
let columns = [ let columns = [
{ {
title: "标签名", title: "标签名",
dataIndex: "name", dataIndex: "name",
align: "center" align: "center",
}, },
{ {
title: '操作', title: "操作",
key: "action", key: "action",
scopedSlots: { customRender: "action" }, scopedSlots: { customRender: "action" },
align: "center" align: "center",
} width: 180,
] },
];
export default { export default {
data(){ data() {
return { return {
loading: false, loading: false,
searchPage: { searchPage: {
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
name: "" name: "",
}, },
columns: columns, columns: columns,
data: [], data: [],
pagination: { pagination: {
showQuickJumper: true, showQuickJumper: true,
showSizeChanger: true showSizeChanger: true,
}, },
modalVisible: false, modalVisible: false,
modalTitle: '添加', modalTitle: "添加",
modalType: '', modalType: "",
rowData: '', rowData: "",
formModel: { formModel: {
name: '' name: "",
}, },
formRules: { formRules: {
name: [ name: [
{ {
required: true, required: true,
message: '不能为空', message: "不能为空",
trigger: 'blur' trigger: "blur",
}, },
] ],
}
}
}, },
created() { };
this.getList(this.searchPage)
}, },
beforeUpdate() { created() {
this.getList(this.searchPage);
}, },
beforeUpdate() {},
methods: { methods: {
getList(query){ getList(query) {
this.loading = true; this.loading = true;
fetchList(query).then(res => { fetchList(query)
if(res.code == 200){ .then((res) => {
this.loading = false if (res.code == 200) {
this.loading = false;
this.data = res.data; this.data = res.data;
const pager = { ...this.pagination }; const pager = { ...this.pagination };
pager.current = query.pageIndex; pager.current = query.pageIndex;
pager.total = res.count; pager.total = res.count;
this.pagination = pager; this.pagination = pager;
}else{ } else {
this.$message.info(res.resp_msg); this.$message.info(res.resp_msg);
} }
}).catch(err => {
this.loading = false
disposereq(this,err)
}) })
.catch((err) => {
this.loading = false;
disposereq(this, err);
});
}, },
blurValidate(prop){ blurValidate(prop) {
this.$refs[prop].onFieldBlur() this.$refs[prop].onFieldBlur();
}, },
// 表格数据变化触发事件 // 表格数据变化触发事件
handleTableChange(pagination, filters, sorter) { handleTableChange(pagination, filters, sorter) {
...@@ -178,25 +191,24 @@ export default { ...@@ -178,25 +191,24 @@ export default {
this.modalVisible = true; this.modalVisible = true;
// 判断添加或者编辑 // 判断添加或者编辑
if (row == "") { if (row == "") {
this.modalTitle = '添加'; this.modalTitle = "添加";
this.modalType = "add"; this.modalType = "add";
this.formModel.name = "" this.formModel.name = "";
this.rowData = '' this.rowData = "";
} else { } else {
this.modalTitle = '编辑'; this.modalTitle = "编辑";
this.modalType = "edit"; this.modalType = "edit";
this.formModel.name = row.name this.formModel.name = row.name;
this.rowData = row; this.rowData = row;
} }
}, },
// 删除行数据 // 删除行数据
deleteRow(row) { deleteRow(row) {
delObj([row.id]) delObj([row.id])
.then(res => { .then((res) => {
this.loading = false; this.loading = false;
if (res.resp_code == 200) { if (res.resp_code == 200) {
this.$message.success('删除成功'); this.$message.success("删除成功");
const searchPage = { ...this.searchPage }; const searchPage = { ...this.searchPage };
this.loading = true; this.loading = true;
this.getList(searchPage); this.getList(searchPage);
...@@ -204,61 +216,62 @@ export default { ...@@ -204,61 +216,62 @@ export default {
this.$message.info(res.resp_msg); this.$message.info(res.resp_msg);
} }
}) })
.catch(err => { .catch((err) => {
disposereq(this, err); disposereq(this, err);
}); });
}, },
//对话框确定 //对话框确定
onSave(){ onSave() {
this.$refs.formModelRef.validate(valid => { this.$refs.formModelRef.validate((valid) => {
if(valid){ if (valid) {
if(this.modalType == 'add'){ if (this.modalType == "add") {
let data = {} let data = {};
data.name = this.formModel.name data.name = this.formModel.name;
addObj(data).then(res => { addObj(data)
if(res.resp_code == 200){ .then((res) => {
this.modalVisible = false if (res.resp_code == 200) {
this.$message.success('保存成功'); this.modalVisible = false;
this.$message.success("保存成功");
const searchPage = { ...this.searchPage }; const searchPage = { ...this.searchPage };
this.loading = true; this.loading = true;
this.getList(searchPage); this.getList(searchPage);
}else{ } else {
this.$message.info(res.resp_msg); this.$message.info(res.resp_msg);
} }
}).catch(err => {
disposereq(this,err)
}) })
}else if(this.modalType == 'edit'){ .catch((err) => {
let data = {} disposereq(this, err);
data.id = this.rowData.id });
data.name = this.formModel.name } else if (this.modalType == "edit") {
putObj(data).then(res => { let data = {};
if(res.resp_code == 200){ data.id = this.rowData.id;
this.modalVisible = false data.name = this.formModel.name;
this.$message.success('保存成功'); putObj(data)
.then((res) => {
if (res.resp_code == 200) {
this.modalVisible = false;
this.$message.success("保存成功");
const searchPage = { ...this.searchPage }; const searchPage = { ...this.searchPage };
this.loading = true; this.loading = true;
this.getList(searchPage); this.getList(searchPage);
}else{ } else {
this.$message.info(res.resp_msg) this.$message.info(res.resp_msg);
} }
}).catch(err => {
disposereq(this,err)
}) })
.catch((err) => {
disposereq(this, err);
});
} }
} }
}) });
}, },
//对话框取消 //对话框取消
onCancel(){ onCancel() {
this.modalVisible = false this.modalVisible = false;
this.$refs.formModelRef.resetFields() this.$refs.formModelRef.resetFields();
},
},
} };
}
}
</script> </script>
<style> <style>
.template_content { .template_content {
......
...@@ -4,13 +4,25 @@ ...@@ -4,13 +4,25 @@
<div class="search_box"> <div class="search_box">
<a-form layout="inline"> <a-form layout="inline">
<a-form-item label="企业名称"> <a-form-item label="企业名称">
<a-input v-model="searchPage.enterpriseName" placeholder="请输入企业名称" allowClear></a-input> <a-input
v-model="searchPage.enterpriseName"
placeholder="请输入企业名称"
allowClear
></a-input>
</a-form-item> </a-form-item>
<a-form-item label="管理员手机号"> <a-form-item label="管理员手机号">
<a-input v-model="searchPage.adminMobile" placeholder="请输入管理员手机号" allowClear></a-input> <a-input
v-model="searchPage.adminMobile"
placeholder="请输入管理员手机号"
allowClear
></a-input>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-button type="primary" icon="search" @click="handlSearch">查询</a-button> <a-button
type="primary"
icon="search"
@click="handlSearch"
>查询</a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
</div> </div>
...@@ -37,33 +49,70 @@ ...@@ -37,33 +49,70 @@
> >
<!-- 企业名称 --> <!-- 企业名称 -->
<div slot="name" slot-scope="text,record"> <div
<a-row type="flex" justify="start"> slot="name"
slot-scope="text,record"
>
<a-row
type="flex"
justify="space-between"
align="start"
>
<!-- 头像 --> <!-- 头像 -->
<a-col> <a-col :span="4">
<a-avatar v-if="!record.logoUrl || record.logoUrl == ''" shape="square" :size="64" icon="user"/> <a-avatar
<a-avatar v-if="record.logoUrl && record.logoUrl != ''" shape="square" :size="64" :src="record.logoUrl"/> v-if="!record.logoUrl || record.logoUrl == ''"
shape="square"
:size="64"
icon="user"
/>
<a-avatar
v-if="record.logoUrl && record.logoUrl != ''"
shape="square"
:size="64"
:src="record.logoUrl"
/>
</a-col> </a-col>
<!-- 企业名称 --> <!-- 企业名称 -->
<a-col> <a-col :span="20">
<span style="margin: 10px;">{{record.name}}</span> <span style="margin: 10px;">{{record.name}}</span>
</a-col> </a-col>
</a-row> </a-row>
</div> </div>
<!-- 用户 --> <!-- 用户 -->
<div slot="adminName" slot-scope="text,record"> <div
<a-row type="flex" justify="start" align="middle"> slot="adminName"
slot-scope="text,record"
>
<a-row
type="flex"
justify="space-between"
align="middle"
>
<!-- 头像 --> <!-- 头像 -->
<a-col :span="4"> <a-col :span="4">
<a-avatar v-if="!record.adminAvatarUrl || record.adminAvatarUrl == ''" shape="square" :size="64" icon="user" /> <a-avatar
<a-avatar v-if="record.adminAvatarUrl && record.adminAvatarUrl != ''" shape="square" :size="64" :src="record.adminAvatarUrl" /> v-if="!record.adminAvatarUrl || record.adminAvatarUrl == ''"
shape="square"
:size="64"
icon="user"
/>
<a-avatar
v-if="record.adminAvatarUrl && record.adminAvatarUrl != ''"
shape="square"
:size="64"
:src="record.adminAvatarUrl"
/>
</a-col> </a-col>
<!-- 管理员姓名、昵称,注册时间 --> <!-- 管理员姓名、昵称,注册时间 -->
<a-col :span="12"> <a-col :span="20">
<a-space direction="vertical" align="start"> <a-space
direction="vertical"
align="start"
>
<span>姓名:{{record.adminName && record.adminName != '' ? record.adminName : '-'}}</span> <span>姓名:{{record.adminName && record.adminName != '' ? record.adminName : '-'}}</span>
<span>昵称:{{record.adminNickName && record.adminNickName != '' ? record.adminNickName : '-'}}</span> <span>昵称:{{record.adminNickName && record.adminNickName != '' ? record.adminNickName : '-'}}</span>
<span>注册时间:{{ timestampToTime(record.createTime) }}</span> <span>注册时间:{{ timestampToymd(record.createTime) }}</span>
</a-space> </a-space>
<!-- <a-row type="flex" justify="start" align="middle"> <!-- <a-row type="flex" justify="start" align="middle">
<a-col :span="24"><span>姓名:{{record.adminName && record.adminName != '' ? record.adminName : '-'}}</span></a-col> <a-col :span="24"><span>姓名:{{record.adminName && record.adminName != '' ? record.adminName : '-'}}</span></a-col>
...@@ -74,24 +123,37 @@ ...@@ -74,24 +123,37 @@
</a-row> </a-row>
</div> </div>
<!-- 用户状态 --> <!-- 用户状态 -->
<div slot="adminStatus" slot-scope="text,record"> <div
<a-tag v-if="record.adminStatus == 'ENABLE'" color="green">启用</a-tag> slot="adminStatus"
<a-tag v-if="record.adminStatus == 'DISABLE'" color="red">禁用</a-tag> slot-scope="text,record"
<a-tag v-if="record.adminStatus == 'UNACTIVATE'" color="orange">未激活</a-tag> >
<a-tag
v-if="record.adminStatus == 'ENABLE'"
color="green"
>启用</a-tag>
<a-tag
v-if="record.adminStatus == 'DISABLE'"
color="red"
>禁用</a-tag>
<a-tag
v-if="record.adminStatus == 'UNACTIVATE'"
color="orange"
>未激活</a-tag>
</div> </div>
<!-- 操作 --> <!-- 操作 -->
<template slot="action" slot-scope="text, record"> <template
slot="action"
slot-scope="text, record"
>
<a-button <a-button
icon="edit" icon="edit"
type="primary" type="link"
class="btn_margin"
@click="showModal(record)" @click="showModal(record)"
>修改</a-button> >修改</a-button>
</template> </template>
</a-table> </a-table>
</div> </div>
<!-- Modal窗口 --> <!-- Modal窗口 -->
<template> <template>
<a-modal <a-modal
...@@ -111,8 +173,20 @@ ...@@ -111,8 +173,20 @@
label="企业LOGO" label="企业LOGO"
prop="logoUrl" prop="logoUrl"
> >
<a-avatar v-if="!formModel.logoUrl || formModel.logoUrl == ''" shape="square" :size="64" icon="user" @click="changeLogo"/> <a-avatar
<a-avatar v-if="formModel.logoUrl && formModel.logoUrl != ''" shape="square" :size="64" :src="formModel.logoUrl" @click="changeLogo" /> v-if="!formModel.logoUrl || formModel.logoUrl == ''"
shape="square"
:size="64"
icon="user"
@click="changeLogo"
/>
<a-avatar
v-if="formModel.logoUrl && formModel.logoUrl != ''"
shape="square"
:size="64"
:src="formModel.logoUrl"
@click="changeLogo"
/>
<a-input <a-input
v-model="formModel.logoUrl" v-model="formModel.logoUrl"
type="hidden" type="hidden"
...@@ -123,9 +197,7 @@ ...@@ -123,9 +197,7 @@
label="企业名称" label="企业名称"
prop="name" prop="name"
> >
<a-input <a-input v-model="formModel.name">
v-model="formModel.name"
>
</a-input> </a-input>
</a-form-model-item> </a-form-model-item>
<a-form-model-item <a-form-model-item
...@@ -162,16 +234,20 @@ ...@@ -162,16 +234,20 @@
label="省/市" label="省/市"
prop="province" prop="province"
> >
<area-cascader v-if="showAreaSelect" type="text" v-model="formModel.areaSelected" :data="pca" placeholder=""></area-cascader> <area-cascader
v-if="showAreaSelect"
type="text"
v-model="formModel.areaSelected"
:data="pca"
placeholder=""
></area-cascader>
</a-form-model-item> </a-form-model-item>
<a-form-model-item <a-form-model-item
label="地址" label="地址"
prop="address" prop="address"
> >
<a-input <a-input v-model="formModel.address">
v-model="formModel.address"
>
</a-input> </a-input>
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
...@@ -181,24 +257,22 @@ ...@@ -181,24 +257,22 @@
</template> </template>
<script> <script>
import { fetchList, addObj, putObj } from "@/api/biz/enterprise";
import {fetchList,addObj,putObj} from '@/api/biz/enterprise' import { disposereq, timestampToTime, timestampToymd } from "@/utils/util";
import { disposereq,timestampToTime } from '@/utils/util' import { pca, pcaa } from "area-data";
import { pca, pcaa } from 'area-data';
let columns = [ let columns = [
{ {
title: '企业名称', title: "企业名称",
dataIndex: 'name', dataIndex: "name",
align: 'center', align: "center",
scopedSlots: {customRender: 'name'} scopedSlots: { customRender: "name" },
}, },
{ {
title: "管理员", title: "管理员",
dataIndex: "adminName", dataIndex: "adminName",
align: "center", align: "center",
scopedSlots: {customRender: 'adminName'} scopedSlots: { customRender: "adminName" },
}, },
{ {
title: "注册手机号", title: "注册手机号",
...@@ -209,211 +283,217 @@ let columns = [ ...@@ -209,211 +283,217 @@ let columns = [
title: "管理员状态", title: "管理员状态",
dataIndex: "adminStatus", dataIndex: "adminStatus",
align: "center", align: "center",
scopedSlots: {customRender: 'adminStatus'} scopedSlots: { customRender: "adminStatus" },
width: 100,
}, },
{ {
title: '成员人数', title: "成员人数",
dataIndex: 'memberCount', dataIndex: "memberCount",
align: 'center' align: "center",
width: 80,
}, },
{ {
title: '最后登陆时间', title: "最后登陆时间",
dataIndex: 'lastLoginTime', dataIndex: "lastLoginTime",
align: 'center', align: "center",
customRender: (text) => { customRender: (text) => {
return text ? timestampToTime(text) : '-' return text ? timestampToTime(text) : "-";
} },
width: 180,
}, },
{ {
title: '操作', title: "操作",
key: "action", key: "action",
scopedSlots: { customRender: "action" }, scopedSlots: { customRender: "action" },
align: "center" align: "center",
} width: 90,
},
] ];
export default { export default {
data(){ data() {
return{ return {
columns: columns, columns: columns,
data: [], data: [],
searchPage: { searchPage: {
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
enterpriseName: '', enterpriseName: "",
adminMobile: '' adminMobile: "",
}, },
pagination: { pagination: {
showQuickJumper: true, showQuickJumper: true,
showSizeChanger: true showSizeChanger: true,
}, },
loading: false, loading: false,
modalVisible: false, modalVisible: false,
modalTitle: '添加', modalTitle: "添加",
modalType: 'add', modalType: "add",
formModel: { formModel: {
id: '', id: "",
name: '', name: "",
logoUrl: '', logoUrl: "",
adminMobile: '', adminMobile: "",
adminNickName: '', adminNickName: "",
adminName: '', adminName: "",
province: '', province: "",
city: '', city: "",
address: '', address: "",
areaSelected: [] areaSelected: [],
}, },
formRules: { formRules: {
name: [ name: [{ required: true, message: "不能为空", trigger: "blur" }],
{required: true,message:'不能为空',trigger:'blur'}
],
adminMobile: [ adminMobile: [
{ {
required: true, message: '不能为空', trigger: 'blur' required: true,
message: "不能为空",
trigger: "blur",
}, },
{ {
pattern: /^1[3456789]\d{9}$/,message: '手机号格式不正确', trigger: 'blur' pattern: /^1[3456789]\d{9}$/,
} message: "手机号格式不正确",
] trigger: "blur",
},
],
}, },
pca, pca,
showAreaSelect: true showAreaSelect: true,
};
}
}, },
// 创建完毕 // 创建完毕
created() { created() {
this.getList(this.searchPage); this.getList(this.searchPage);
}, },
// 即将更新渲染 // 即将更新渲染
beforeUpdate() { beforeUpdate() {},
},
methods: { methods: {
getList(query){ getList(query) {
this.loading = true; this.loading = true;
fetchList(query).then(res => { fetchList(query)
if(res.code == 200){ .then((res) => {
this.data = res.data if (res.code == 200) {
let paper = {...this.pagination} this.data = res.data;
paper.current = query.pageIndex let paper = { ...this.pagination };
paper.total = res.count paper.current = query.pageIndex;
this.pagination = paper paper.total = res.count;
}else{ this.pagination = paper;
this.$message.info(res.resp_msg) } else {
this.$message.info(res.resp_msg);
} }
this.loading = false; this.loading = false;
}).catch(err => {
this.loading = false;
disposereq(this,err)
}) })
.catch((err) => {
this.loading = false;
disposereq(this, err);
});
}, },
handleTableChange(){ handleTableChange() {
let queryParam = {...this.searchPage} let queryParam = { ...this.searchPage };
queryParam.pageIndex = pagination.current queryParam.pageIndex = pagination.current;
queryParam.pageSize = pagination.pageSize queryParam.pageSize = pagination.pageSize;
this.getList(queryParam) this.getList(queryParam);
}, },
handlSearch(){ handlSearch() {
let queryParam = {...this.searchPage} let queryParam = { ...this.searchPage };
this.getList(queryParam) this.getList(queryParam);
}, },
timestampToTime, timestampToTime,
showModal(row){ timestampToymd,
showModal(row) {
// console.log(this.formModel.areaSelected) // console.log(this.formModel.areaSelected)
this.modalVisible = true this.modalVisible = true;
if(row == ''){ if (row == "") {
this.modalTitle = '添加' this.modalTitle = "添加";
this.modalType = 'add' this.modalType = "add";
}else{ } else {
this.modalTitle = '编辑' this.modalTitle = "编辑";
this.modalType = 'edit' this.modalType = "edit";
if(row.province && row.city){ if (row.province && row.city) {
row.areaSelected = [row.province,row.city] row.areaSelected = [row.province, row.city];
} }
this.formModel = {...row} this.formModel = { ...row };
} }
}, },
saveData(){ saveData() {
if(this.modalType == 'add'){ if (this.modalType == "add") {
let data = {...this.formModel} let data = { ...this.formModel };
if(data.areaSelected.length > 0){ if (data.areaSelected.length > 0) {
data.province = data.areaSelected[0] data.province = data.areaSelected[0];
data.city = data.areaSelected[1] data.city = data.areaSelected[1];
} }
addObj(data).then(res => { addObj(data)
if(res.resp_code == 200){ .then((res) => {
this.$message.info('保存成功') if (res.resp_code == 200) {
this.getList(this.searchPage) this.$message.info("保存成功");
this.closeModal() this.getList(this.searchPage);
}else{ this.closeModal();
this.$message.info(res.resp_msg) } else {
this.$message.info(res.resp_msg);
} }
}).catch(err => {
disposereq(this,err)
}) })
}else if(this.modalType == 'edit'){ .catch((err) => {
let data = {...this.formModel} disposereq(this, err);
if(data.areaSelected.length > 0){ });
data.province = data.areaSelected[0] } else if (this.modalType == "edit") {
data.city = data.areaSelected[1] let data = { ...this.formModel };
if (data.areaSelected.length > 0) {
data.province = data.areaSelected[0];
data.city = data.areaSelected[1];
} }
putObj(data).then(res => { putObj(data)
if(res.resp_code == 200){ .then((res) => {
this.$message.info('保存成功') if (res.resp_code == 200) {
this.getList(this.searchPage) this.$message.info("保存成功");
this.closeModal() this.getList(this.searchPage);
}else{ this.closeModal();
this.$message.info(res.resp_msg) } else {
this.$message.info(res.resp_msg);
} }
}).catch(err => {
disposereq(this,err)
}) })
.catch((err) => {
disposereq(this, err);
});
} }
}, },
onConfirm(){ onConfirm() {
this.$refs.formModelRef.validate(valid => { this.$refs.formModelRef.validate((valid) => {
if(valid){ if (valid) {
this.saveData() this.saveData();
} else {
}else{ return false;
return false
} }
}) });
}, },
onCancel(){ onCancel() {
this.closeModal() this.closeModal();
}, },
closeModal(){ closeModal() {
this.modalVisible = false this.modalVisible = false;
this.formModel = { this.formModel = {
id: '', id: "",
name: '', name: "",
logoUrl: '', logoUrl: "",
adminMobile: '', adminMobile: "",
adminNickName: '', adminNickName: "",
adminName: '', adminName: "",
province: '', province: "",
city: '', city: "",
address: '', address: "",
areaSelected: [] areaSelected: [],
} };
this.resetAreaSelected() this.resetAreaSelected();
}, },
resetAreaSelected(){ resetAreaSelected() {
this.showAreaSelect = false this.showAreaSelect = false;
var t = setTimeout(() => { var t = setTimeout(() => {
this.showAreaSelect = true this.showAreaSelect = true;
},0); }, 0);
}, },
changeLogo(){ changeLogo() {
console.log('changeLogo click') console.log("changeLogo click");
} },
} },
} };
</script> </script>
<style> <style>
.template_content { .template_content {
......
...@@ -37,18 +37,16 @@ ...@@ -37,18 +37,16 @@
<!-- 表格操作 --> <!-- 表格操作 -->
<template slot="action" slot-scope="text,record"> <template slot="action" slot-scope="text,record">
<a-button <a-button
type="primary" type="link"
icon="edit" icon="edit"
@click="showModal(record)" @click="showModal(record)"
class="btn_margin"
> >
修改 修改
</a-button> </a-button>
<a-button <a-button
type="danger"
icon="delete" icon="delete"
@click="deleteRow(record)" @click="deleteRow(record)"
class="btn_margin" type="link"
> >
删除 删除
</a-button> </a-button>
...@@ -130,7 +128,8 @@ let columns = [ ...@@ -130,7 +128,8 @@ let columns = [
title: '操作', title: '操作',
key: "action", key: "action",
scopedSlots: { customRender: "action" }, scopedSlots: { customRender: "action" },
align: "center" align: "center",
width: 180,
} }
] ]
......
<template> <template>
<div> <div class="price-config-container">
<a-form-model <a-form-model
:model="formModel" :model="formModel"
:label-col="{span:4}" :label-col="{span:4}"
...@@ -168,5 +168,7 @@ export default { ...@@ -168,5 +168,7 @@ export default {
} }
</script> </script>
<style> <style>
.price-config-container{
margin: 10px;
}
</style> </style>
\ No newline at end of file
...@@ -40,18 +40,18 @@ ...@@ -40,18 +40,18 @@
<!-- 表格操作 --> <!-- 表格操作 -->
<template slot="action" slot-scope="text,record"> <template slot="action" slot-scope="text,record">
<a-button <a-button
type="primary"
icon="edit" icon="edit"
@click="showModal(record)" @click="showModal(record)"
class="btn_margin" type="link"
> >
修改 修改
</a-button> </a-button>
<a-button <a-button
type="danger"
icon="delete" icon="delete"
@click="deleteRow(record)" @click="deleteRow(record)"
class="btn_margin" type="link"
> >
删除 删除
</a-button> </a-button>
...@@ -139,7 +139,8 @@ let columns = [ ...@@ -139,7 +139,8 @@ let columns = [
{ {
title: "讲师编号", title: "讲师编号",
dataIndex: "code", dataIndex: "code",
align: "center" align: "center",
width: 120,
}, },
{ {
title: "讲师名称", title: "讲师名称",
...@@ -165,13 +166,15 @@ let columns = [ ...@@ -165,13 +166,15 @@ let columns = [
{ {
title: "课程数", title: "课程数",
dataIndex: "courseCount", dataIndex: "courseCount",
align: "center" align: "center",
width: 80,
}, },
{ {
title: '操作', title: '操作',
key: "action", key: "action",
scopedSlots: { customRender: "action" }, scopedSlots: { customRender: "action" },
align: "center" align: "center",
width: 180,
} }
] ]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment