Commit eb0dc95b authored by 罗超's avatar 罗超

完成校区管理

parent 97a2192c
......@@ -4,11 +4,11 @@ import request from '../../utils/request'
* 获取学校分页列表
*
*/
export function getschoolpage(data) {
export function getSchoolPage(data) {
return request({
url: '/user/GetSchoolPageList',
method: 'post',
data: data
data
})
}
......@@ -16,10 +16,10 @@ export function getschoolpage(data) {
* 获取学校分页列表
*
*/
export function testapi(cmd,msgData) {
export function saveSchool(data) {
return request({
url: cmd,
url: '/user/SetSchool',
method: 'post',
data: msgData
data
})
}
\ No newline at end of file
......@@ -4,12 +4,14 @@
thead
background: rgb(245, 246, 247)
thead tr th
thead tr:first-child
height: 40px
line-height: 14px
thead tr:first-child th
font-size: 12px
font-weight: 400
color: rgb(168, 168, 179)
line-height: 14px
height: 40px
thead tr:first-child th:first-child
background-color: rgb(245, 246, 247)
......@@ -22,4 +24,7 @@
position: sticky
left: 0
z-index: 1
box-shadow: rgba(0, 0, 0, 0.05) 2px 0px 0px
\ No newline at end of file
box-shadow: rgba(0, 0, 0, 0.05) 2px 0px 0px
td.none-shadow
box-shadow: none
\ No newline at end of file
......@@ -22,3 +22,4 @@ $positive : #43e97b
$negative : #f5576c
$info : #31CCEC
$warning : #F2C037
$infobg : #eeeeee
\ No newline at end of file
......@@ -12,7 +12,7 @@
<q-route-tab v-for="(x, i) in userInfo.MenuList" :key="i" :to="x.MenuUrl" :name="`navs_${i}`" :label="x.MenuName" :icon="x.MenuIcon" />
</q-tabs>
<div class="q-pl-lg">
<q-btn-dropdown flat color="primary">
<q-btn-dropdown flat color="primary" size="xs">
<template v-slot:label>
<q-icon left name="iconfont icon-message" class="text-white" style="font-size:20px;">
<q-badge color="negative" floating>4</q-badge>
......@@ -115,7 +115,7 @@
</q-item>
</q-list>
</q-btn-dropdown>
<q-btn-dropdown flat color="primary" v-if="userInfo">
<q-btn-dropdown flat color="primary" size="xs" v-if="userInfo">
<template v-slot:label>
<q-avatar size="28px">
<img :src="userInfo.UserIcon">
......@@ -166,8 +166,10 @@
</template>
</q-list>
</div>
<div class="col" style="background: #f2f4f7;padding:20px">
<router-view />
<div class="col" style="background: #f2f4f7;">
<q-scroll-area class="fit" :thumb-style="thumbStyle" :bar-style="barStyle" visible style="">
<router-view style="margin:20px" />
</q-scroll-area>
</div>
</div>
......@@ -191,7 +193,21 @@ export default {
//essentialLinks: linksData
tab: "navs_0",
currentPath: "",
secondNavs: []
secondNavs: [],
thumbStyle: {
right: '0px',
borderRadius: '0px',
backgroundColor: '#1d1d1d',
width: '6px',
opacity: 1
},
barStyle: {
right: '0px',
borderRadius: '0px',
backgroundColor: '#999',
width: '6px',
opacity: 0.5
}
}
},
watch: {
......
......@@ -3,16 +3,16 @@
<div class="page-search row items-center">
<div class="col row wrap q-mr-lg q-col-gutter-md">
<div class="col-3">
<q-input clearable standout="bg-primary text-white" v-model="msg.SchoolName" label="校区名称" />
<q-input @change="resetSearch" clearable standout="bg-primary text-white" v-model="msg.SName" label="校区名称" />
</div>
<div class="col-3">
<q-select standout="bg-primary text-white" v-model="msg.Status" :options="StatusOpts" option-value="value" option-label="label" label="校区状态" />
<q-select @input="resetSearch" standout="bg-primary text-white" v-model="StatusTemp" :options="StatusOpts" option-value="value" option-label="label" label="校区状态" />
</div>
</div>
<div class="page-option">
<!-- 原则上不能操作过三个按钮,建议不要使用查询按钮,增加用户操作次数 -->
<!-- <q-btn color="primary" outline label="立即查询" /> -->
<q-btn color="accent" class="q-mr-md" icon="add" label="新增校区" />
<q-btn color="accent" class="q-mr-md" icon="add" label="新增校区" @click="initObj(null)" />
<q-btn-dropdown outline color="dark" label="更多">
<q-list>
<q-item clickable v-close-popup @click="onItemClick">
......@@ -34,220 +34,247 @@
</div>
</div>
<div class="page-content">
<q-table flat class="sticky-column-table" separator="none" title="校区信息" :data="data" :columns="columns" row-key="name" />
<q-table :pagination="msg" :loading="loading" no-data-label="暂无相关数据" flat class="sticky-column-table" separator="none" title="校区信息" :data="data" :columns="columns" row-key="name">
<template v-slot:body-cell-Status="props">
<q-td :props="props">
<q-badge :color="props.value==1?'negative':'primary'" :label="props.value==1?'关闭':'正常'" />
</q-td>
</template>
<template v-slot:body-cell-Remark="props">
<q-td :props="props">
<q-badge color="grey-3 text-grey-10" :label="props.value" />
</q-td>
</template>
<template v-slot:body-cell-optioned="props">
<q-td :props="props">
<q-btn flat size="xs" icon="edit" color="accent" style="font-family:perfectFont" label="编辑" @click="initObj(props.value)" />
</q-td>
</template>
<template v-slot:bottom>
<q-pagination class="full-width justify-end" v-model="msg.pageIndex" color="primary" :max="pageCount" :input="true" @input="changePage" />
</template>
</q-table>
<q-dialog v-model="persistent" content-class="bg-grey-1" persistent transition-show="scale" transition-hide="scale">
<q-card style="width: 800px;max-width:900px;">
<q-card-section>
<div class="text-h6">{{objOption.SId==0?'新增校区':'修改校区'}}</div>
</q-card-section>
<div class="text-caption q-mb-lg q-px-md text-grey-6">基本资料</div>
<q-card-section class="q-pt-none">
<div class="row wrap">
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.SName" ref="SName" class="col-6 q-pr-lg q-pb-lg" label="校区名称" :rules="[val => !!val || '请填写校区名称']" />
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.SAddress" ref="SAddress" class="col-6 q-pb-lg" label="校区地址" :rules="[val => !!val || '请填写校区地址']" />
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.SLinkMan" ref="SLinkMan" class="col-6 q-pr-lg q-pb-lg " label="校区联系人" :rules="[val => !!val || '请填写校区联系人']" />
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.SLinkTel" ref="SLinkTel" class="col-6 q-pb-lg" label="校区联系电话" :rules="[val => !!val || '请填写校区联系电话']" />
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.Remark" class="col-6 q-pb-lg q-pr-lg" label="校区备注" />
<div class="col-6">
<q-toggle size="md" label="校区状态" color="primary" :false-value="1" :true-value="0" v-model="objOption.Status" />
<div class="text-grey-6 text-caption">注意:关闭校区后,所有下属教师、学生将无法继续使用系统</div>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" color="dark" style="font-weight:400 !important" @click="closeSaveForm" />
<q-btn label="立即提交" color="accent q-px-md" style="font-weight:400 !important" :loading="saveLoading" @click="saveSchool" />
</q-card-actions>
</q-card>
</q-dialog>
</div>
</div>
</template>
<script>
import {
getSchoolPage,
saveSchool
} from '../../api/school/index'
export default {
meta: {
title: "校区管理"
},
data() {
return {
currentUrl: "",
columns: [{
name: 'name',
name: 'SName',
required: true,
label: '公司名称',
align: 'left',
field: row => row.name,
field: row => row.SName,
format: val => `${val}`,
sortable: true
},
{
name: 'caloriesss',
align: 'center',
label: '联系人',
field: 'calories',
sortable: true
},
{
name: 'fatss',
label: '联系电话',
field: 'fat',
sortable: true
},
{
name: 'carbs',
label: '状态',
field: 'carbs'
},
{
name: 'protein',
label: '是否显示',
field: 'protein'
},
{
name: 'sodium',
label: 'B2B是否显示',
field: 'sodium'
},
{
name: 'calcium',
label: '公司类型',
field: 'calcium',
sortable: true,
sort: (a, b) => parseInt(a, 10) - parseInt(b, 10)
},
{
name: 'iron',
label: '服务费率',
field: 'iron',
sortable: true,
sort: (a, b) => parseInt(a, 10) - parseInt(b, 10)
},
{
name: 'calories',
align: 'center',
label: '操作类型',
field: 'calories',
sortable: true
},
{
name: 'fat',
label: '下属',
field: 'fat',
sortable: true
},
{
name: 'caloriess',
align: 'center',
label: 'Calories',
field: 'calories',
name: 'GroupName',
label: '所属机构',
field: 'GroupName',
align: 'left',
sortable: true
},
{
name: 'fats',
label: 'Fat (g)',
field: 'fat',
name: 'SLinkMan',
label: '负责人',
field: 'SLinkMan',
align: 'left',
sortable: true
},
],
data: [{
name: 'Frozen Yogurt',
calories: 159,
fat: 6.0,
carbs: 24,
protein: 4.0,
sodium: 87,
calcium: '14%',
iron: '1%'
},
{
name: 'Ice cream sandwich',
calories: 237,
fat: 9.0,
carbs: 37,
protein: 4.3,
sodium: 129,
calcium: '8%',
iron: '1%'
},
{
name: 'Eclair',
calories: 262,
fat: 16.0,
carbs: 23,
protein: 6.0,
sodium: 337,
calcium: '6%',
iron: '7%'
},
{
name: 'Cupcake',
calories: 305,
fat: 3.7,
carbs: 67,
protein: 4.3,
sodium: 413,
calcium: '3%',
iron: '8%'
name: 'SLinkTel',
label: '负责人电话',
align: 'left',
field: 'SLinkTel'
},
{
name: 'Gingerbread',
calories: 356,
fat: 16.0,
carbs: 49,
protein: 3.9,
sodium: 327,
calcium: '7%',
iron: '16%'
name: 'Status',
label: '状态',
align: 'left',
field: 'Status'
},
{
name: 'Jelly bean',
calories: 375,
fat: 0.0,
carbs: 94,
protein: 0.0,
sodium: 50,
calcium: '0%',
iron: '0%'
name: 'CreateByName',
label: '创建人',
align: 'left',
field: 'CreateByName'
},
{
name: 'Lollipop',
calories: 392,
fat: 0.2,
carbs: 98,
protein: 0,
sodium: 38,
calcium: '0%',
iron: '2%'
name: 'CreateTimeStr',
label: '建立时间',
align: 'left',
field: 'CreateTimeStr'
},
{
name: 'Honeycomb',
calories: 408,
fat: 3.2,
carbs: 87,
protein: 6.5,
sodium: 562,
calcium: '0%',
iron: '45%'
name: 'Remark',
label: '备注',
align: 'left',
field: 'Remark'
},
{
name: 'Donut',
calories: 452,
fat: 25.0,
carbs: 51,
protein: 4.9,
sodium: 326,
calcium: '2%',
iron: '22%'
name: 'optioned',
label: '操作',
field: 'SId'
},
{
name: 'KitKat',
calories: 518,
fat: 26.0,
carbs: 65,
protein: 7,
sodium: 54,
calcium: '12%',
iron: '6%'
}
],
data: [],
loading: true,
StatusOpts: [{
label: '全部',
value: ''
value: '-1'
},
{
label: '开启',
value: '1'
value: '0'
},
{
label: '关闭',
value: '0'
value: '1'
}
],
msg: {
SchoolName: "",
Status: ""
}
pageIndex: 1,
pageSize: 13,
rowsPerPage: 13,
SName: "",
Status: '-1'
},
StatusTemp: {},
pageCount: 0,
persistent: false,
objOption: {},
saveLoading: false
}
},
created() {
this.StatusTemp = this.StatusOpts[0]
},
mounted() {
this.currentUrl = this.$route.path
this.getSchool()
},
methods: {
onItemClick() {
},
initObj(id) {
if (id) {
let obj = this.data.filter(x => {
if (x.SId == id) {
return x
}
return false
})
console.log(obj)
this.objOption = obj[0]
} else {
this.objOption = {
SId: 0,
SName: "",
SAddress: "",
SLinkMan: "",
SLinkTel: "",
SDomain: "",
SLogo: "",
Remark: "",
Status: '0'
}
}
console.log(this.objOption)
this.persistent = true
},
resetSearch() {
this.pageIndex = 1
//this.pageCount = 0
this.loading = true
this.msg.Status = this.StatusTemp ? this.StatusTemp.value : '-1'
this.getSchool()
},
changePage(val) {
this.msg.Status = this.StatusTemp ? this.StatusTemp.value : '-1'
this.msg.pageIndex = 1
this.loading = true
this.getSchool()
},
getSchool() {
getSchoolPage(this.msg).then(res => {
this.loading = false
this.data = res.Data.PageData
this.pageCount = res.Data.PageCount
}).catch(() => {
this.loading = false
})
},
closeSaveForm() {
this.persistent = false
},
saveSchool() {
this.saveLoading = true
this.$refs.SName.validate()
this.$refs.SAddress.validate()
this.$refs.SLinkMan.validate()
this.$refs.SLinkTel.validate()
if (
!this.$refs.SName.hasError &&
!this.$refs.SAddress.hasError &&
!this.$refs.SLinkMan.hasError &&
!this.$refs.SLinkTel.hasError
) {
saveSchool(this.objOption).then(res => {
this.saveLoading = false
this.$q.notify({
icon: 'success',
color: 'primary',
message: '数据处理成功!',
position: 'top'
})
if (this.objOption.SId == 0) {
this.msg.pageIndex = 1
}
this.getSchool()
this.closeSaveForm()
})
} else {
this.saveLoading = false
}
}
},
}
......
......@@ -26,7 +26,7 @@
</q-carousel>
</div>
<div class="right-card">
<div class="company">甲鹤日语教育</div>
<div class="company">羚羊教育系统后台登录</div>
<div class="t">登录</div>
<div class="field_wrap">
<div class="pwd_box">
......
......@@ -4,7 +4,6 @@ import user from './modules/user'
import permission from './modules/permission'
import app from './modules/app'
import getters from './getters'
import school from './modules/school'
Vue.use(Vuex)
......@@ -27,8 +26,7 @@ const store = new Vuex.Store({
modules: {
user,
permission,
app,
school
app
},
getters,
strict: process.env.DEV
......
import { getschoolpage,testapi } from "../../api/school/school";
import { addAuth, removeAuth } from "../../utils/auth";
import Lockr from "lockr";
const school = {
state: {
userInfo: null, // 用户信息
//TODO 用户权限
allAuth: ['/home'],
},
mutations: {
SET_USERINFO: (state, userInfo) => {
state.userInfo = userInfo;
},
SET_ALLAUTH: (state, allAuth) => {
state.allAuth = allAuth
},
//TODO 用户权限
},
actions: {
// 获取权限
GetSchoolPage({ commit },data) {
return new Promise((resolve, reject) => {
getschoolpage(data)
.then(res => {
resolve(res);
})
.catch(error => {
console.log(error)
reject(error);
});
});
},
//测试Api
TestWebApi({commit},postData)
{
return new Promise((resolve, reject) => {
testapi(postData.cmdStr,postData.data)
.then(res => {
resolve(res);
})
.catch(error => {
console.log(error)
reject(error);
});
});
},
}
};
export default school;
\ No newline at end of file
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