Commit f33c4049 authored by Liu Peng's avatar Liu Peng

调整页面样式

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