init project

This commit is contained in:
illuz committed 2022-07-05 14:40:21 +08:00
commit 571ba2a8a1
34 files changed
+3618

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
'use strict';
module.exports = {
write: true,
prefix: '^',
plugin: 'autod-egg',
test: [
'test',
'benchmark',
],
dep: [
'egg',
'egg-scripts',
],
devdep: [
'egg-ci',
'egg-bin',
'egg-mock',
'autod',
'autod-egg',
'eslint',
'eslint-config-egg',
],
exclude: [
'./test/fixtures',
'./dist',
],
};
+2
View File
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
+25
View File
@@ -0,0 +1,25 @@
logs/
npm-debug.log
yarn-error.log
*.log
node_modules/
package-lock.json
yarn.lock
coverage/
.idea/
.github/
run/
.DS_Store
*.sw*
*.un~
typings/
.nyc_output/
config/config.local.js
config/config.prod.js
config/config.unittest.js
upload/**
multipartTmp/**
.vscode
.travis.yml
appveyor.yml
+45
View File
@@ -0,0 +1,45 @@
# xianfeng-v1
## 配置
1. npm install
2. 复制 `config.local.example.js` 为 `config.local.js`
3. 并且修改数据库配置为自己的数据库, 例如:
```
host: '127.0.0.1',
port: 3306,
user: 'root',
password: '123456',
database: 'xianfeng-v1'
```
4. 启动 npm run dev
## 数据库
```sql
# 数据库初始化
create database `xianfeng-v1` default character set utf8mb4 collate utf8mb4_bin;
use xianfeng-v1;
# 运行 sql/xianfeng-v1.sql 文件
```
## 测试账号 & 测试环境
- admin/123456
## 页面
1. 应用协议: studentManagement01.html
* 增删改查(select,insert,softUpdate,softDelete)
2. 前端对接: studentManagement03.html
3. 前端优化: studentManagement04.html
4. 服务端搜索: studentManagement05.html
* 应用协议:sql演示
## FAQ
- egg-jianghu mysql view
```sql
DROP VIEW IF EXISTS `_view01_user`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `_view01_user` AS select * from `_user`;
```
+14
View File
@@ -0,0 +1,14 @@
'use strict';
class AppBootHook {
constructor(app) {
this.app = app;
}
async serverDidReady() {
}
}
module.exports = AppBootHook;
View File
Whitespace-only changes.
View File
Whitespace-only changes.
View File
Whitespace-only changes.
View File
Whitespace-only changes.
View File
Whitespace-only changes.
+59
View File
@@ -0,0 +1,59 @@
'use strict';
// ========================================常用 require start===========================================
const Service = require('egg').Service;
const validateUtil = require("egg-jianghu/app/common/validateUtil");
const idGenerateUtil = require("egg-jianghu/app/common/idGenerateUtil");
const dayjs = require("dayjs");
const actionDataScheme = Object.freeze({
beforHookForGenerateStudentId: {
type: "object",
additionalProperties: true,
required: ["dateOfBirth"],
properties: {
dateOfBirth: { type: "string", format: "date" },
},
},
});
class StudentService extends Service {
async beforHookForGenerateStudentId() {
const { actionData } = this.ctx.request.body.appData;
validateUtil.validate(
actionDataScheme.beforHookForGenerateStudentId,
actionData
);
const { dateOfBirth } = actionData;
const dateOfBirthObj = dayjs(dateOfBirth);
const studentId = `S_${idGenerateUtil.uuid(
8
)}_${dateOfBirthObj.month()}_${dateOfBirthObj.day()}`;
this.ctx.request.body.appData.actionData.studentId = studentId;
}
async appendStudentInfoToUserInfo() {
const studentInfo = await this.app
.jianghuKnex("student")
.where({ studentId: this.ctx.userInfo.user.userId })
.first();
this.ctx.userInfo.studentInfo = studentInfo || { classId: null };
}
async selectStudentList() {
const studentInfo = await this.app
.jianghuKnex("student")
.where({ studentId: this.ctx.userInfo.user.userId })
.first();
const studentList = await this.app
.jianghuKnex("student")
.where({ classId: studentInfo.classId })
.select();
return {
rows: studentList,
};
}
}
module.exports = StudentService;
+77
View File
@@ -0,0 +1,77 @@
<script type="text/x-template" id="classSelectDialog">
<span>
<v-select class="mr-4" @mouseup="classSelectDialog_shown = true" v-model="classSelectDialog_selected"
:items="classSelectDialog_dataList" readonly :label="classSelectDialog_title" hide-details dense
outlined hide-no-data hide-selected />
<v-dialog v-model="classSelectDialog_shown" scrollable max-width="500px">
<v-card>
<v-card-title>
<span>{{ classSelectDialog_title }}</span>
<v-text-field
label="搜索"
clearable
dense
v-model="classSelectDialog_filterText"
hide-details
prepend-inner-icon="mdi-text-search"
class="ma-2 pa-0"
outlined
></v-text-field>
</v-card-title>
<v-divider />
<div class="list">
<v-list rounded>
<v-list-item-group color="primary" active-class>
<v-list-item v-for="(item, index) in classSelectDialog_dataList_filter" :key="item.value" @click="selectItem({ item })">
<template #default="{ active }">
<v-list-item-content>
<v-list-item-title v-text="item.text" />
</v-list-item-content>
</template>
</v-list-item>
</v-list-item-group>
</v-list>
</div>
<v-divider />
<v-card-actions>
<v-spacer />
<v-btn color="primary" text @click="classSelectDialog_shown = false">取消</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</span>
</script>
<script>
Vue.component("classSelectDialog", {
template: "#classSelectDialog",
vueComponent: 'classSelectDialog',
mixins: [ window.jianghuUiActionMixins ],
data: () => (window.vueData),
computed: {
classSelectDialog_dataList_filter() {
const classSelectDialog_filterText = (this.classSelectDialog_filterText || '').toLowerCase();
let list = this.classSelectDialog_dataList.slice();
list = list.filter((item) =>
item.text &&
( item.text.toLowerCase().includes(classSelectDialog_filterText) ||
item.text.includes(classSelectDialog_filterText)
)
)
return list;
},
},
methods: {
selectItem({ item }) {
this.classSelectDialog_selected = item.value;
this.classSelectDialog_shown = false;
},
},
});
</script>
<style>
.list {
max-height: 700px;
overflow-y: scroll;
}
</style>
+347
View File
@@ -0,0 +1,347 @@
{% extends 'template/jhTemplate.html'%}
{% block vue_template %}
<jh-layout>
<!-- 页面主要内容 -->
<v-container class="fullScreen d-flex flex-column pa-xs-0 pa-0">
<v-row class="ma-0 pa-xs-4 align-center flex-none pt-0 " :class="{'pa-4': !isMobile, 'pb-0': !isMobile, 'pa-2': isMobile}">
<v-col cols="12" sm="12" md="3" xl="2" class="pa-xs-0 pb-3" :class="{'pb-xs-4': !isMobile}">
<v-text-field v-model="serverSearchInput.studentId" label="学生ID" class="cus-v-input " :class="{'mr-2': !isMobile}" dense outlined></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="3" xl="2" class="pa-xs-0 pb-3" :class="{'pb-xs-4': !isMobile, 'mt-2': isMobile}">
<v-text-field v-model="serverSearchInput.classId" label="班级ID" class="cus-v-input" :class="{'mr-2': !isMobile}" dense outlined></v-text-field>
</v-col>
<v-col :class="{'pb-xs-4': !isMobile, 'pt-2': isMobile, 'pl-0': isMobile}" cols="12" md="2" sm="12" xl="3">
<v-btn
class="elevation-0"
color="success"
dark
@click="refreshTableData"
>
查询
</v-btn>
</v-col>
</v-row>
<v-divider></v-divider>
<v-row class="ma-0 pa-xs-4 align-center flex-none pt-0 " :class="{'pa-4': !isMobile, 'pb-0': !isMobile, 'pa-2': isMobile}">
<v-col cols="12" xs="4" sm="4" md="4" xl="4" class="pl-0">
<v-btn color="success" small dark class="elevation-0 mr-2" @click="doUiAction('startCreateItem', null)">新增</v-btn>
<span class="body-2">共{{ tableData.length }}条记录</span>
</v-col>
<v-spacer></v-spacer>
<v-col cols="12" xs="8" sm="3" md="2" xl="2" class="pa-xs-0 pa-xs-2 col-sm-8-flex pl-0">
<v-select class="cus-v-input mr-2" v-model="currentTableGenderType" :items="[{value: 'all', text: '全部'}, ...constantCollection.gender]"
prefix="性别:" dense item-text="text" item-value="value" dense outlined></v-select>
</v-col>
<v-col cols="12" xs="8" sm="4" md="3" xl="3" class="pa-xs-0 pa-xs-2 col-sm-8-flex">
<v-text-field v-model="searchInput" label="表格过滤" class="cus-v-input" dense outlined></v-text-field>
</v-col>
</v-row>
<v-data-table fixed-header
:headers="headers"
:items="tableData"
:search="searchInput"
:footer-props="{ itemsPerPageOptions: [20, 40, 60, 100, -1] }"
:items-per-page="20"
mobile-breakpoint="0"
:loading="isTableLoading"
checkbox-color="success"
class="elevation-0 mt-0 mb-xs-4 flex-fill d-flex flex-column">
<template v-slot:item.gender="{ item }">
{{ getConstantCollectionItemText('gender', item.gender) }}
</template>
<template v-slot:item.level="{ item }">
{{ getConstantCollectionItemText('level', item.level) }}
</template>
<template v-slot:item.action="{ item }">
<v-btn small class="mr-2 success" @click="doUiAction('startUpdateItem', item)">
修改
</v-btn>
<v-btn small class="mr-2 error" @click="doUiAction('deleteItem', item)">
删除
</v-btn>
</template>
</v-data-table>
</v-container>
<!-- 编辑抽屉 -->
<v-navigation-drawer v-model="isEditDrawerShow" absolute temporary right width="80%" hide-overlay
class="elevation-24">
<v-form v-model="isFormValid" v-if="isEditDrawerShow" ref="form" lazy-validation>
<v-row>
<span class="title pa-6">{{ editItem.id ? "修改" : "新增" }}信息</span>
<v-spacer></v-spacer>
<v-btn class="mt-7 mr-8 elevation-0" fab x-small @click="isEditDrawerShow = false">
<v-icon dark>mdi-close</v-icon>
</v-btn>
</v-row>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生ID" v-model="editItem.studentId" :rules="requireRules"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="班级ID" v-model="editItem.classId" :items="constantCollection.classId"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生名字" v-model="editItem.name"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="年级" v-model="editItem.level" :items="constantCollection.level"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="性别" v-model="editItem.gender" :items="constantCollection.gender"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-menu class="cus-v-input mr-2" offset-y max-width="290">
<template v-slot:activator="{ on, attrs }">
<v-text-field class="cus-v-input mr-2" dense outlined v-on="on" label="出生日期" v-model="editItem.dateOfBirth"></v-text-field>
</template>
<v-date-picker color="success" elevation="20" v-model="editItem.dateOfBirth"></v-date-picker>
</v-menu>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="身高" v-model="editItem.bodyHeight"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="学生状态" v-model="editItem.studentStatus" :items="constantCollection.studentStatus"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="备注" v-model="editItem.remarks"></v-text-field>
</v-col>
</v-row>
<v-row class="justify-end pr-6">
<v-btn color="success" small @click="doUiAction(dialogSaveInfoAction)" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mb-2': isMobile, 'mr-4': isMobile}">保存</v-btn>
<v-btn class="ml-2" small @click="isEditDrawerShow = false" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mr-4': isMobile}">取消</v-btn>
</v-row>
</v-form>
</v-navigation-drawer>
</jh-layout>
{% endblock %}
{% block vue_body %}
<script type="module">
window.registerData({
// 表格相关数据
isFormValid: true,
requireRules: [
v => !!v || 'This is required',
],
constantCollection: {
gender: [{"value": "male", "text": "男"}, {"value": "female", "text": "女"}],
classId: [
{"value": "2021-01级-01班", "text": "2021-01级-01班"}, {"value": "2021-01级-02班", "text": "2021-01级-02班"},
{"value": "2021-02级-01班", "text": "2021-02级-01班"}, {"value": "2021-02级-02班", "text": "2021-02级-02班"},
{"value": "2021-03级-01班", "text": "2021-03级-01班"}, {"value": "2021-03级-02班", "text": "2021-03级-02班"}
],
level: [{"value": "01", "text": "一年级"}, {"value": "02", "text": "二年级"}, {"value": "03", "text": "三年级"}],
icType: [{"value": "身份证", "text": "身份证"}, {"value": "护照", "text": "护照"}],
enrollmentType: [{"value": "正常升学", "text": "正常升学"}, {"value": "借读", "text": "借读"}],
studentStatus: [{"value": "正常", "text": "正常"}, {"value": "退学", "text": "退学"}]
},
serverSearchInput: {
studentId: null,
classId: null
},
currentTableGenderType: 'all',
isEditDrawerShow: false,
searchInput: null,
isTableLoading: true,
tableDataFromBackend: [],
headers: [
{text: "学生ID", value: "studentId", width: 120, class: 'fixed', cellClass: 'fixed'},
{text: "班级ID", value: "classId", width: 140},
{text: "学生名字", value: "name", width: 120},
{text: "年级", value: "level", width: 120},
{text: "性别", value: "gender", width: 120},
{text: "出生日期", value: "dateOfBirth", width: 120},
{text: "身高", value: "bodyHeight", width: 120},
{text: "学生状态", value: "studentStatus", width: 120},
{text: "备注", value: "remarks", width: 120},
{text: "操作者", value: "operationByUser", width: 120},
{text: "操作时间", value: "operationAt", width: 250},
{text: '操作', value: 'action', align: 'center', sortable: false, width: 200, class: 'fixed', cellClass: 'fixed'},
],
editItem: {},
dialogSaveInfoAction: ''
})
</script>
{% include 'layout/jhLayout.html' %}
{% include 'common/resetTableMaxHeight.html' %}
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vueComponent: 'page',
vuetify: new Vuetify(),
mixins: [window.jianghuUiActionMixins],
data: () => window.vueData,
computed: {
isMobile() {
return window.innerWidth < 600;
},
tableData() {
if (!this.currentTableGenderType || this.currentTableGenderType === 'all') {
return this.tableDataFromBackend;
}
return this.tableDataFromBackend.filter(({gender}) => gender === this.currentTableGenderType);
},
computedEditItem() {
return this.editItem;
},
},
watch: {},
async created() {
},
mounted() {
this.doUiAction('refreshTableData');
},
methods: {
/**
* 获取表格数据
*/
async refreshTableData() {
this.isTableLoading = true;
const serverSearchInput = _.pickBy(this.serverSearchInput, value=> !!value);
const { data: { appData: { rows } } } = await window.jianghuAxios({
data: {
appData: {
pageId: 'backendSearchDemo',
actionId: 'selectItemList',
actionData: {},
where: {},
whereLike: serverSearchInput,
orderBy: [{column: 'operationAt', order: 'desc'}]
}
}
});
await window.jianghuAxios({
data: {
appData: {
pageId: 'allPage',
actionId: 'getConstantList',
actionData: {},
where: {},
}
}
})
this.tableDataFromBackend = rows;
this.isTableLoading = false;
},
async clearItemData() {
this.editItem = {};
},
// validate
prepareValidate() {
return this.$refs.form.validate();
},
async openCreateDialog() {
this.isEditDrawerShow = true;
this.dialogSaveInfoAction = 'createItem';
},
async confirmCreateItemDialog() {
return window.confirmDialog({ title: '新增', content: '确定新增吗?'})
},
async doCreateItem() {
delete this.computedEditItem.id;
await window.vtoast.loading("新增学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'backendSearchDemo',
actionId: 'insertItem',
actionData: this.computedEditItem
}
}
})
await window.vtoast.success("新增学生成功");
},
async closeDrawerShow() {
this.isEditDrawerShow = false;
},
async prepareItemData(item) {
this.editItem = {...item};
},
async openUpdateDialog() {
this.isEditDrawerShow = true;
this.dialogSaveInfoAction = 'updateItem';
},
async confirmUpdateItemDialog() {
return window.confirmDialog({ title: '修改', content: '确定修改吗?'});
},
async doUpdateItem() {
const id = this.computedEditItem.id;
delete this.computedEditItem.id;
await window.vtoast.loading("修改学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'backendSearchDemo',
actionId: 'updateItem',
actionData: this.computedEditItem,
where: {id: id}
}
}
})
await window.vtoast.success("修改学生成功");
this.isEditDrawerShow = false;
},
async confirmDeleteItemDialog() {
return window.confirmDialog({ title: '删除', content: '确定删除吗?'});
},
async doDeleteItem() {
const { id } = this.computedEditItem;
await window.vtoast.loading("删除学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'backendSearchDemo',
actionId: 'deleteItem',
actionData: {},
where: { id: id }
}
}
});
await window.vtoast.success("删除学生成功");
},
getConstantCollectionItemText(key, _value) {
const constantCollectionItemFind = this.constantCollection[key].find(({value}) => value === _value);
if(constantCollectionItemFind) {
return constantCollectionItemFind.text;
}
return _value;
}
}
})
</script>
<style scoped>
</style>
{% endblock %}
+360
View File
@@ -0,0 +1,360 @@
{% extends 'template/jhTemplate.html'%}
{% block vue_template %}
<jh-layout>
<!-- 页面主要内容 -->
<v-container class="fullScreen d-flex flex-column pa-xs-0 pa-0">
<div>
<span class="red">备注: 需要为当前用户创建一条学生数据, 用户只能看到自己所在班级的数据。</span>
</div>
<v-row class="ma-0 pa-xs-4 align-center flex-none pt-0 " :class="{'pa-4': !isMobile, 'pb-0': !isMobile, 'pa-2': isMobile}">
<v-col cols="12" xs="4" sm="4" md="4" xl="4" class="pl-0">
<v-btn color="success" small dark class="elevation-0 mr-2" @click="doUiAction('startCreateItem', null)">新增</v-btn>
<span class="body-2">共{{ tableData.length }}条记录</span>
</v-col>
<v-spacer></v-spacer>
<v-select style="max-width: 200px;" class="cus-v-input mr-2" v-model="currentTableGenderType" :items="[{value: 'all', text: '全部'}, ...constantCollection.gender]"
prefix="性别:" dense item-text="text" item-value="value" dense outlined></v-select>
<v-text-field style="max-width: 200px;" v-model="searchInput" label="表格过滤" class="cus-v-input" dense outlined></v-text-field>
</v-row>
<v-data-table fixed-header
:headers="headers"
:items="tableData"
:search="searchInput"
:footer-props="{ itemsPerPageOptions: [20, 40, 60, 100, -1] }"
:items-per-page="20"
mobile-breakpoint="0"
:loading="isTableLoading"
checkbox-color="success"
class="elevation-0 mt-0 mb-xs-4 flex-fill d-flex flex-column">
<template v-slot:item.gender="{ item }">
{{ getConstantCollectionItemText('gender', item.gender) }}
</template>
<template v-slot:item.level="{ item }">
{{ getConstantCollectionItemText('level', item.level) }}
</template>
<template v-slot:item.action="{ item }">
<v-btn small class="mr-2 success" @click="doUiAction('startUpdateItem', item)">
修改
</v-btn>
<v-btn small class="mr-2 error" @click="doUiAction('deleteItem', item)">
删除
</v-btn>
</template>
</v-data-table>
</v-container>
<!-- 编辑抽屉 -->
<v-navigation-drawer v-model="isEditDrawerShow" absolute temporary right width="80%" hide-overlay
class="elevation-24">
<v-form v-model="isFormValid" ref="form" lazy-validation>
<v-row>
<span class="title pa-6">{{ currentClickButton.title }}信息</span>
<v-spacer></v-spacer>
<v-btn class="mt-7 mr-8 elevation-0" fab x-small @click="isEditDrawerShow = false">
<v-icon dark>mdi-close</v-icon>
</v-btn>
</v-row>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生ID" v-model="editItem.studentId" :rules="requireRules"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="班级ID" v-model="editItem.classId" :items="constantCollection.classId"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生名字" v-model="editItem.name"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="年级" v-model="editItem.level" :items="constantCollection.level"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="性别" v-model="editItem.gender" :items="constantCollection.gender"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-menu class="cus-v-input mr-2" offset-y max-width="290">
<template v-slot:activator="{ on, attrs }">
<v-text-field class="cus-v-input mr-2" dense outlined v-on="on" label="出生日期" v-model="editItem.dateOfBirth"></v-text-field>
</template>
<v-date-picker color="success" elevation="20" v-model="editItem.dateOfBirth"></v-date-picker>
</v-menu>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="身高" v-model="editItem.bodyHeight"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="学生状态" v-model="editItem.studentStatus" :items="constantCollection.studentStatus"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="备注" v-model="editItem.remarks"></v-text-field>
</v-col>
</v-row>
<v-row class="justify-end pr-6">
<v-btn color="success" small @click="doUiAction(dialogSaveInfoAction)" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mb-2': isMobile, 'mr-4': isMobile}">保存</v-btn>
<v-btn class="ml-2" small @click="isEditDrawerShow = false" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mr-4': isMobile}">取消</v-btn>
</v-row>
</v-form>
</v-navigation-drawer>
</jh-layout>
{% endblock %}
{% block vue_body %}
<script type="module">
window.registerData({
// 表格相关数据
isFormValid: true,
requireRules: [
v => !!v || 'This is required',
],
constantCollection: {
gender: [{"value": "male", "text": "男"}, {"value": "female", "text": "女"}],
classId: [
{"value": "2021-01级-01班", "text": "2021-01级-01班"}, {"value": "2021-01级-02班", "text": "2021-01级-02班"},
{"value": "2021-02级-01班", "text": "2021-02级-01班"}, {"value": "2021-02级-02班", "text": "2021-02级-02班"},
{"value": "2021-03级-01班", "text": "2021-03级-01班"}, {"value": "2021-03级-02班", "text": "2021-03级-02班"}
],
level: [{"value": "01", "text": "一年级"}, {"value": "02", "text": "二年级"}, {"value": "03", "text": "三年级"}],
icType: [{"value": "身份证", "text": "身份证"}, {"value": "护照", "text": "护照"}],
enrollmentType: [{"value": "正常升学", "text": "正常升学"}, {"value": "借读", "text": "借读"}],
studentStatus: [{"value": "正常", "text": "正常"}, {"value": "退学", "text": "退学"}]
},
currentTableGenderType: 'all',
isEditDrawerShow: false,
searchInput: null,
isTableLoading: true,
tableDataFromBackend: [],
headers: [
{text: "学生ID", value: "studentId", type: "input", width: 120, class: 'fixed', cellClass: 'fixed'},
{text: "班级ID", value: "classId", type: "select", width: 140},
{text: "学生名字", value: "name", type: "input", width: 120},
{text: "年级", value: "level", type: "select", width: 120},
{text: "性别", value: "gender", type: "select", width: 120},
{text: "出生日期", value: "dateOfBirth", type: "date", width: 120},
{text: "身高", value: "bodyHeight", type: "input", width: 120},
{text: "学生状态", value: "studentStatus", type: "select", width: 120},
{text: "备注", value: "remarks", type: "textarea", width: 120},
{text: "操作者", value: "operationByUser", type: "input", width: 120},
{text: "操作时间", value: "operationAt", type: "input", width: 250},
{text: '操作', value: 'action', type: 'button', align: 'center', sortable: false, width: 200, class: 'fixed', cellClass: 'fixed'},
],
currentClickButton: {title: '新增', action: 'add'},
editItem: {},
dialogSaveInfoAction: ''
})
</script>
{% include 'layout/jhLayout.html' %}
{% include 'common/resetTableMaxHeight.html' %}
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vueComponent: 'page',
vuetify: new Vuetify(),
mixins: [window.jianghuUiActionMixins],
data: () => ({
// 表格相关数据
isFormValid: true,
requireRules: [
v => !!v || 'This is required',
],
constantCollection: {
gender: [{"value": "male", "text": "男"}, {"value": "female", "text": "女"}],
classId: [
{"value": "2021-01级-01班", "text": "2021-01级-01班"}, {"value": "2021-01级-02班", "text": "2021-01级-02班"},
{"value": "2021-02级-01班", "text": "2021-02级-01班"}, {"value": "2021-02级-02班", "text": "2021-02级-02班"},
{"value": "2021-03级-01班", "text": "2021-03级-01班"}, {"value": "2021-03级-02班", "text": "2021-03级-02班"}
],
level: [{"value": "01", "text": "一年级"}, {"value": "02", "text": "二年级"}, {"value": "03", "text": "三年级"}],
icType: [{"value": "身份证", "text": "身份证"}, {"value": "护照", "text": "护照"}],
enrollmentType: [{"value": "正常升学", "text": "正常升学"}, {"value": "借读", "text": "借读"}],
studentStatus: [{"value": "正常", "text": "正常"}, {"value": "退学", "text": "退学"}]
},
currentTableGenderType: 'all',
isEditDrawerShow: false,
searchInput: null,
isTableLoading: true,
tableDataFromBackend: [],
headers: [
{text: "学生ID", value: "studentId", type: "input", width: 120, class: 'fixed', cellClass: 'fixed'},
{text: "班级ID", value: "classId", type: "select", width: 140},
{text: "学生名字", value: "name", type: "input", width: 120},
{text: "年级", value: "level", type: "select", width: 120},
{text: "性别", value: "gender", type: "select", width: 120},
{text: "出生日期", value: "dateOfBirth", type: "date", width: 120},
{text: "身高", value: "bodyHeight", type: "input", width: 120},
{text: "学生状态", value: "studentStatus", type: "select", width: 120},
{text: "备注", value: "remarks", type: "textarea", width: 120},
{text: "操作者", value: "operationByUser", type: "input", width: 120},
{text: "操作时间", value: "operationAt", type: "input", width: 250},
{text: '操作', value: 'action', type: 'button', align: 'center', sortable: false, width: 200, class: 'fixed', cellClass: 'fixed'},
],
currentClickButton: {title: '新增', action: 'add'},
editItem: {},
tableButtonList: [
{text: '修改', buttonType: 'edit', color: 'success',},
{text: '删除', buttonType: 'delete', color: 'error',},
],
}),
computed: {
isMobile() {
return window.innerWidth < 600;
},
tableData() {
if (!this.currentTableGenderType || this.currentTableGenderType === 'all') {
return this.tableDataFromBackend;
}
return this.tableDataFromBackend.filter(({gender}) => gender === this.currentTableGenderType);
},
computedEditItem() {
return this.editItem;
},
},
watch: {},
async created() {
},
mounted() {
this.doUiAction('refreshTableData');
},
methods: {
/**
* 获取表格数据
*/
async refreshTableData() {
this.isTableLoading = true;
const result = await window.jianghuAxios({
data: {
appData: {
pageId: 'dataAccessRight',
actionId: 'selectItemListByDynamicData',// 'selectItemListByService', 'selectItemListBySql'
actionData: {},
where: {},
orderBy: [{column: 'operationAt', order: 'desc'}]
}
}
});
this.tableDataFromBackend = result.data.appData.rows;
this.isTableLoading = false;
},
async clearItemData() {
this.editItem = {};
},
async openCreateDialog() {
this.currentClickButton = {action: 'add', title: '新增'};
this.isEditDrawerShow = true;
this.dialogSaveInfoAction = 'createItem';
},
// validate
prepareValidate() {
return this.$refs.form.validate();
},
async confirmCreateItemDialog() {
return window.confirmDialog({ title: '新增', content: '确定新增吗?'});
},
/**
* 新增学生
*/
async doCreateItem() {
delete this.computedEditItem.id;
await window.vtoast.loading("新增学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'dataAccessRight',
actionId: 'insertItem',
actionData: this.computedEditItem
}
}
})
await window.vtoast.success("新增学生成功");
this.isEditDrawerShow = false;
},
async closeDrawerShow() {
this.isEditDrawerShow = false;
},
async prepareItemData(item) {
this.editItem = {...item};
},
async openUpdateDialog() {
this.currentClickButton = {action: 'edit', title: '修改'};
this.isEditDrawerShow = true;
this.dialogSaveInfoAction = 'updateItem';
},
async confirmUpdateItemDialog() {
return window.confirmDialog({ title: '修改', content: '确定修改吗?'});
},
/**
* 保存学生
*/
async doUpdateItem() {
const id = this.computedEditItem.id;
delete this.computedEditItem.id;
await window.vtoast.loading("修改学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'dataAccessRight',
actionId: 'updateItem',
actionData: this.computedEditItem,
where: {id: id}
}
}
})
await window.vtoast.success("修改学生成功");
this.isEditDrawerShow = false;
},
async confirmDeleteItemDialog() {
return window.confirmDialog({ title: '删除', content: '确定删除吗?'});
},
async doDeleteItem() {
const { id } = this.computedEditItem;
await window.vtoast.loading("删除学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'backendSearchDemo',
actionId: 'deleteItem',
actionData: {},
where: { id: id }
}
}
});
await window.vtoast.success("删除学生成功");
},
getConstantCollectionItemText(key, _value) {
const constantCollectionItemFind = this.constantCollection[key].find(({value}) => value === _value);
if(constantCollectionItemFind) {
return constantCollectionItemFind.text;
}
return _value;
}
}
})
</script>
<style scoped>
</style>
{% endblock %}
+358
View File
@@ -0,0 +1,358 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>江湖演示-初级</title>
<meta charset="utf-8" name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"/>
<link href="/xianfeng-v1/public/css/global.css" rel="stylesheet">
<link href="/xianfeng-v1/public/css/materialdesignicons.min.css" rel="stylesheet">
<link href="/xianfeng-v1/public/css/vuetify.min.css" rel="stylesheet">
<link href="/xianfeng-v1/public/css/vuetify.custom.css" rel="stylesheet">
<script src="/xianfeng-v1/public/js/lib/axios.min.js"></script>
<script src="/xianfeng-v1/public/js/lib/vue.js"></script>
<script src="/xianfeng-v1/public/js/lib/vuetify.min.js"></script>
</head>
<body>
<div id="app">
<v-app>
<!-- 菜单栏 -->
<v-app-bar
app
color="secondary"
clipped-left
dark
height="55"
flat
>
<v-toolbar-title class="mr-4 align-center" style="font-size: 14px">
<span class="title" style="font-size: 1rem!important;">江湖演示-初级</span>
</v-toolbar-title>
<v-tabs
v-model="menuSelectedIndex"
show-arrows
slider-size="5"
style="max-width: calc(100vw - 280px)"
>
<v-tabs-slider color="success"></v-tabs-slider>
<template v-for="item in inMenuList">
<v-tab
class="pl-3 pr-3"
:key="item.path"
@click="jump({ path: item.path })"
>
{{ item.title }}
</v-tab>
</template>
</v-tabs>
<v-spacer/>
<!--
<div style="white-space: nowrap">
<v-btn disabled text class="ml-1 text-none" style="color: #ffffff!important;">
admin
</v-btn>
<v-btn icon small class="ml-1">
<v-icon>mdi-account-circle</v-icon>
</v-btn>
</div>
-->
</v-app-bar>
<v-main>
<!-- 页面主要内容 -->
<v-container class="fullScreen d-flex flex-column pa-xs-0 pa-0">
<v-row class="ma-0 pa-xs-4 align-center flex-none pt-0 " :class="{'pa-4': !isMobile, 'pb-0': !isMobile, 'pa-2': isMobile}">
<v-col cols="12" xs="4" sm="4" md="4" xl="4" class="pl-0">
<v-btn color="success" small dark class="elevation-0 mr-2" @click="openEditDialog({ item: {} })">新增</v-btn>
<span class="body-2">共{{ tableData.length }}条记录</span>
</v-col>
<v-spacer></v-spacer>
<v-col cols="12" xs="8" sm="3" md="2" xl="2" class="pa-xs-0 pa-xs-2 col-sm-8-flex pl-0">
<v-select class="cus-v-input mr-2" v-model="currentTableGenderType" :items="[{value: 'all', text: '全部'}, ...constantCollection.gender]"
prefix="性别:" dense item-text="text" item-value="value" dense outlined></v-select>
</v-col>
<v-col cols="12" xs="8" sm="4" md="3" xl="3" class="pa-xs-0 pa-xs-2 col-sm-8-flex">
<v-text-field v-model="searchInput" label="表格过滤" class="cus-v-input" dense outlined></v-text-field>
</v-col>
</v-row>
<v-data-table fixed-header
:headers="headers"
:items="tableData"
:search="searchInput"
:footer-props="{ itemsPerPageOptions: [20, 40, 60, 100, -1] }"
:items-per-page="20"
mobile-breakpoint="0"
:loading="isTableLoading"
checkbox-color="success"
class="elevation-0 mt-0 mb-xs-4 flex-fill d-flex flex-column">
<template v-slot:item.action="{ item }">
<v-btn small class="mr-2 success" @click="openEditDialog({ item })">
修改
</v-btn>
<v-btn small class="mr-2 error" @click="deleteStudent({ item })">
删除
</v-btn>
</template>
</v-data-table>
</v-container>
<!-- 编辑抽屉 -->
<v-navigation-drawer v-model="isEditDrawerShow" absolute temporary right width="80%" hide-overlay
class="elevation-24">
<v-form v-model="isFormValid" v-if="isEditDrawerShow" ref="form" lazy-validation>
<v-row>
<span class="title pa-6">{{ currentClickButton.title }}信息</span>
<v-spacer></v-spacer>
<v-btn class="mt-7 mr-8 elevation-0" fab x-small @click="isEditDrawerShow = false">
<v-icon dark>mdi-close</v-icon>
</v-btn>
</v-row>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生ID" v-model="editItem.studentId" :rules="requireRules"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="班级ID" v-model="editItem.classId" :items="constantCollection.classId"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生名字" v-model="editItem.name"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="年级" v-model="editItem.level" :items="constantCollection.level"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="性别" v-model="editItem.gender" :items="constantCollection.gender"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-menu class="cus-v-input mr-2" offset-y max-width="290">
<template v-slot:activator="{ on, attrs }">
<v-text-field class="cus-v-input mr-2" dense outlined v-on="on" label="出生日期" v-model="editItem.dateOfBirth"></v-text-field>
</template>
<v-date-picker color="success" elevation="20" v-model="editItem.dateOfBirth"></v-date-picker>
</v-menu>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="身高" v-model="editItem.bodyHeight"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="学生状态" v-model="editItem.studentStatus" :items="constantCollection.studentStatus"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="备注" v-model="editItem.remarks"></v-text-field>
</v-col>
</v-row>
<v-row class="justify-end pr-6">
<v-btn v-if="editItem.id" color="success" small @click="updateStudent" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mb-2': isMobile, 'mr-4': isMobile}">修改</v-btn>
<v-btn v-if="!editItem.id" color="success" small @click="insertStudent" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mb-2': isMobile, 'mr-4': isMobile}">创建</v-btn>
<v-btn class="ml-2" small @click="isEditDrawerShow = false" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mr-4': isMobile}">取消</v-btn>
</v-row>
</v-form>
</v-navigation-drawer>
</v-main>
</v-app>
</div>
<script>
new Vue({
el: '#app',
vuetify: new Vuetify(),
data: {
// 菜单相关数据
menuSelectedIndex: 1,
inMenuList: [
{
"path": `/xianfeng-v1/page/manual`,
"title": "操作手册",
},
{
"path": `/xianfeng-v1/page/frontendDemo01`,
"title": "前端对接-学习",
}
],
// 表格相关数据
isFormValid: true,
requireRules: [
v => !!v || 'This is required',
],
constantCollection: {
gender: [{"value": "male", "text": "男"}, {"value": "female", "text": "女"}],
classId: [
{"value": "2021-01级-01班", "text": "2021-01级-01班"}, {"value": "2021-01级-02班", "text": "2021-01级-02班"},
{"value": "2021-02级-01班", "text": "2021-02级-01班"}, {"value": "2021-02级-02班", "text": "2021-02级-02班"},
{"value": "2021-03级-01班", "text": "2021-03级-01班"}, {"value": "2021-03级-02班", "text": "2021-03级-02班"}
],
level: [{"value": "01", "text": "一年级"}, {"value": "02", "text": "二年级"}, {"value": "03", "text": "三年级"}],
icType: [{"value": "身份证", "text": "身份证"}, {"value": "护照", "text": "护照"}],
enrollmentType: [{"value": "正常升学", "text": "正常升学"}, {"value": "借读", "text": "借读"}],
studentStatus: [{"value": "正常", "text": "正常"}, {"value": "退学", "text": "退学"}]
},
currentTableGenderType: 'all',
isEditDrawerShow: false,
searchInput: null,
isTableLoading: true,
tableDataFromBackend: [],
headers: [
{text: "学生ID", value: "studentId", width: 120, class: 'fixed', cellClass: 'fixed'},
{text: "班级ID", value: "classId", width: 140},
{text: "学生名字", value: "name", width: 120},
{text: "年级", value: "level", width: 120},
{text: "性别", value: "gender", width: 120},
{text: "出生日期", value: "dateOfBirth", width: 120},
{text: "身高", value: "bodyHeight", width: 120},
{text: "学生状态", value: "studentStatus", width: 120},
{text: "备注", value: "remarks", width: 120},
{text: "操作者", value: "operationByUser", width: 120},
{text: "操作时间", value: "operationAt", width: 250},
{text: '操作', value: 'action', align: 'center', sortable: false, width: 200, class: 'fixed', cellClass: 'fixed'},
],
currentClickButton: {title: '新增', action: 'add'},
editItem: {},
tableButtonList: [
{text: '修改', buttonType: 'edit', color: 'success',},
{text: '删除', buttonType: 'delete', color: 'error',},
],
},
computed: {
isMobile() {
return window.innerWidth < 600;
},
tableData() {
if (!this.currentTableGenderType || this.currentTableGenderType === 'all') {
return this.tableDataFromBackend;
}
return this.tableDataFromBackend.filter(({gender}) => gender === this.currentTableGenderType);
},
},
watch: {},
async created() {
await this.getTableData();
},
mounted() {
},
methods: {
/**
* 获取表格数据
*/
async getTableData() {
this.isTableLoading = true;
const result = await axios({
method: 'post',
url: `/xianfeng-v1/resource`,
data: {
packageId: '123456',
packageType: 'httpRequest',
appData: {
appId: 'xianfeng-v1',
pageId: 'frontendDemo01',
actionId: 'selectItemList',
userAgent: 'demo_userAgent',
authToken: localStorage.getItem(`xianfeng-v1_authToken`),
actionData: {},
where: {},
orderBy: [{column: 'operationAt', order: 'desc'}]
}
}
});
this.tableDataFromBackend = result.data.appData.rows;
this.isTableLoading = false;
},
openEditDialog({ item }) {
this.editItem = item;
this.isEditDrawerShow = true;
},
/**
* 删除学生
*/
async deleteStudent({ item }) {
const { id } = item;
await axios({
method: 'post',
url: `/xianfeng-v1/resource`,
data: {
packageId: '123456',
packageType: 'httpRequest',
appData: {
appId: 'xianfeng-v1',
pageId: 'frontendDemo01',
actionId: 'deleteItem',
userAgent: 'demo_userAgent',
authToken: localStorage.getItem(`xianfeng-v1_authToken`),
actionData: {},
where: { id: id }
}
}
});
await this.getTableData();
},
/**
* 新增学生
*/
async insertStudent() {
if (!this.$refs.form.validate()) return false;
const { id, ...actionData } = this.editItem;
await axios({
method: 'post',
url: `/xianfeng-v1/resource`,
data: {
packageId: '123456',
packageType: 'httpRequest',
appData: {
appId: 'xianfeng-v1',
pageId: 'frontendDemo01',
actionId: 'insertItem',
userAgent: 'demo_userAgent',
authToken: localStorage.getItem(`xianfeng-v1_authToken`),
actionData: actionData
}
}
})
this.isEditDrawerShow = false;
await this.getTableData();
},
/**
* 保存学生
*/
async updateStudent() {
if (!this.$refs.form.validate()) return false;
const { id, ...actionData } = this.editItem;
await axios({
method: 'post',
url: `/xianfeng-v1/resource`,
data: {
packageId: '123456',
packageType: 'httpRequest',
appData: {
appId: 'xianfeng-v1',
pageId: 'frontendDemo01',
actionId: 'updateItem',
userAgent: 'demo_userAgent',
authToken: localStorage.getItem(`xianfeng-v1_authToken`),
actionData: actionData,
where: {id}
}
}
})
this.isEditDrawerShow = false;
await this.getTableData();
},
jump({ path }) {
window.location.href = path;
}
}
})
</script>
</body>
+323
View File
@@ -0,0 +1,323 @@
{% extends 'template/jhTemplate.html'%}
{% block vue_template %}
<jh-layout>
<!-- 页面主要内容 -->
<v-container class="fullScreen d-flex flex-column pa-xs-0 pa-0">
<v-row class="ma-0 pa-xs-4 align-center flex-none pt-0 " :class="{'pa-4': !isMobile, 'pb-0': !isMobile, 'pa-2': isMobile}">
<v-col cols="12" xs="4" sm="4" md="4" xl="4" class="pl-0">
<v-btn color="success" small dark class="elevation-0 mr-2" @click="handleTableButton({ text: '新增', buttonType: 'add' }, null)">新增</v-btn>
<span class="body-2">共{{ tableData.length }}条记录</span>
</v-col>
<v-spacer></v-spacer>
<v-col cols="12" xs="8" sm="3" md="2" xl="2" class="pa-xs-0 pa-xs-2 col-sm-8-flex pl-0">
<v-select class="cus-v-input mr-2" v-model="currentTableGenderType" :items="[{value: 'all', text: '全部'}, ...constantCollection.gender]"
prefix="性别:" dense item-text="text" item-value="value" dense outlined></v-select>
</v-col>
<v-col cols="12" xs="8" sm="4" md="3" xl="3" class="pa-xs-0 pa-xs-2 col-sm-8-flex">
<v-text-field v-model="searchInput" label="表格过滤" class="cus-v-input" dense outlined></v-text-field>
</v-col>
</v-row>
<v-data-table fixed-header
:headers="headers"
:items="tableData"
:search="searchInput"
:footer-props="{ itemsPerPageOptions: [20, 40, 60, 100, -1] }"
:items-per-page="20"
mobile-breakpoint="0"
:loading="isTableLoading"
checkbox-color="success"
class="elevation-0 mt-0 mb-xs-4 flex-fill d-flex flex-column">
<template v-slot:item.gender="{ item }">
{{ getConstantCollectionItemText('gender', item.gender) }}
</template>
<template v-slot:item.level="{ item }">
{{ getConstantCollectionItemText('level', item.level) }}
</template>
<template v-slot:item.action="{ item }">
<v-btn small class="mr-2" :class="tableButton.color" v-for="tableButton of tableButtonList" @click="handleTableButton(tableButton, item)">
{{ tableButton.text }}
</v-btn>
</template>
</v-data-table>
</v-container>
<!-- 编辑抽屉 -->
<v-navigation-drawer v-model="isEditDrawerShow" absolute temporary right width="80%" hide-overlay
class="elevation-24">
<v-form v-model="isFormValid" v-if="isEditDrawerShow" ref="form" lazy-validation>
<v-row>
<span class="title pa-6">{{ currentClickButton.title }}信息</span>
<v-spacer></v-spacer>
<v-btn class="mt-7 mr-8 elevation-0" fab x-small @click="isEditDrawerShow = false">
<v-icon dark>mdi-close</v-icon>
</v-btn>
</v-row>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生ID" v-model="editItem.studentId" :rules="requireRules"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="班级ID" v-model="editItem.classId" :items="constantCollection.classId"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生名字" v-model="editItem.name"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="年级" v-model="editItem.level" :items="constantCollection.level"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="性别" v-model="editItem.gender" :items="constantCollection.gender"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-menu class="cus-v-input mr-2" offset-y max-width="290">
<template v-slot:activator="{ on, attrs }">
<v-text-field class="cus-v-input mr-2" dense outlined v-on="on" label="出生日期" v-model="editItem.dateOfBirth"></v-text-field>
</template>
<v-date-picker color="success" elevation="20" v-model="editItem.dateOfBirth"></v-date-picker>
</v-menu>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="身高" v-model="editItem.bodyHeight"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="学生状态" v-model="editItem.studentStatus" :items="constantCollection.studentStatus"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="备注" v-model="editItem.remarks"></v-text-field>
</v-col>
</v-row>
<v-row class="justify-end pr-6">
<v-btn color="success" small @click="saveInfo" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mb-2': isMobile, 'mr-4': isMobile}">保存</v-btn>
<v-btn class="ml-2" small @click="isEditDrawerShow = false" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mr-4': isMobile}">取消</v-btn>
</v-row>
</v-form>
</v-navigation-drawer>
</jh-layout>
{% endblock %}
{% block vue_body %}
{% include 'layout/jhLayout.html' %}
{% include 'common/resetTableMaxHeight.html' %}
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vuetify: new Vuetify(),
data: () => ({
// 表格相关数据
isFormValid: true,
requireRules: [
v => !!v || 'This is required',
],
constantCollection: {
gender: [{"value": "male", "text": "男"}, {"value": "female", "text": "女"}],
classId: [
{"value": "2021-01级-01班", "text": "2021-01级-01班"}, {"value": "2021-01级-02班", "text": "2021-01级-02班"},
{"value": "2021-02级-01班", "text": "2021-02级-01班"}, {"value": "2021-02级-02班", "text": "2021-02级-02班"},
{"value": "2021-03级-01班", "text": "2021-03级-01班"}, {"value": "2021-03级-02班", "text": "2021-03级-02班"}
],
level: [{"value": "01", "text": "一年级"}, {"value": "02", "text": "二年级"}, {"value": "03", "text": "三年级"}],
icType: [{"value": "身份证", "text": "身份证"}, {"value": "护照", "text": "护照"}],
enrollmentType: [{"value": "正常升学", "text": "正常升学"}, {"value": "借读", "text": "借读"}],
studentStatus: [{"value": "正常", "text": "正常"}, {"value": "退学", "text": "退学"}]
},
currentTableGenderType: 'all',
isEditDrawerShow: false,
searchInput: null,
isTableLoading: true,
tableDataFromBackend: [],
headers: [
{text: "学生ID", value: "studentId", width: 120, class: 'fixed', cellClass: 'fixed'},
{text: "班级ID", value: "classId", width: 140},
{text: "学生名字", value: "name", width: 120},
{text: "年级", value: "level", width: 120},
{text: "性别", value: "gender", width: 120},
{text: "出生日期", value: "dateOfBirth", width: 120},
{text: "身高", value: "bodyHeight", width: 120},
{text: "学生状态", value: "studentStatus", width: 120},
{text: "备注", value: "remarks", width: 120},
{text: "操作者", value: "operationByUser", width: 120},
{text: "操作时间", value: "operationAt", width: 250},
{text: '操作', value: 'action', align: 'center', sortable: false, width: 200, class: 'fixed', cellClass: 'fixed'},
],
currentClickButton: {title: '新增', action: 'add'},
editItem: {},
tableButtonList: [
{text: '修改', buttonType: 'edit', color: 'success',},
{text: '删除', buttonType: 'delete', color: 'error',},
],
}),
computed: {
isMobile() {
return window.innerWidth < 600;
},
tableData() {
if (!this.currentTableGenderType || this.currentTableGenderType === 'all') {
return this.tableDataFromBackend;
}
return this.tableDataFromBackend.filter(({gender}) => gender === this.currentTableGenderType);
},
computedEditItem() {
return this.editItem;
},
},
watch: {},
async created() {
await this.getTableData();
},
mounted() {},
methods: {
/**
* 获取表格数据
*/
async getTableData() {
this.isTableLoading = true;
const result = await window.jianghuAxios({
data: {
appData: {
pageId: 'frontendDemo02',
actionId: 'selectItemList',
actionData: {},
where: {},
orderBy: [{column: 'operationAt', order: 'desc'}]
}
}
});
this.tableDataFromBackend = result.data.appData.rows;
this.isTableLoading = false;
},
// validate
prepareValidate() {
return this.$refs.form.validate();
},
/**
* 点击表格数据按钮
*/
async handleTableButton(button, item) {
const buttonType = button.buttonType;
switch (buttonType) {
case 'edit':
this.currentClickButton = {action: 'edit', title: '修改'};
this.editItem = {...item};
this.isEditDrawerShow = true;
break;
case 'add':
this.currentClickButton = {action: 'add', title: '新增'};
this.editItem = {};
this.isEditDrawerShow = true;
break;
case 'delete':
this.editItem = {...item};
await this.deleteStudent();
break;
}
},
/**
* 删除学生
*/
async deleteStudent() {
const dialogDone = await window.confirmDialog({ title: '删除', content: '确定删除吗?'});
if (!dialogDone) {
return false;
}
const { id } = this.computedEditItem;
await window.vtoast.loading("删除学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'frontendDemo02',
actionId: 'deleteItem',
actionData: {},
where: { id: id }
}
}
});
await window.vtoast.success("删除学生成功");
await this.getTableData();
},
/**
* 保存数据
*/
async saveInfo() {
if (!this.prepareValidate()) return false
if (this.currentClickButton.action === 'add') {
await this.insertStudent();
}
if (this.currentClickButton.action === 'edit') {
await this.updateStudent();
}
},
/**
* 新增学生
*/
async insertStudent() {
if (await window.confirmDialog({ title: '新增', content: '确定新增吗?'})) {
delete this.computedEditItem.id;
await window.vtoast.loading("新增学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'frontendDemo02',
actionId: 'insertItem',
actionData: this.computedEditItem
}
}
})
await window.vtoast.success("新增学生成功");
this.isEditDrawerShow = false;
await this.getTableData();
}
},
/**
* 保存学生
*/
async updateStudent() {
if (await window.confirmDialog({ title: '修改', content: '确定修改吗?'})) {
const id = this.computedEditItem.id;
delete this.computedEditItem.id;
await window.vtoast.loading("修改学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'frontendDemo02',
actionId: 'updateItem',
actionData: this.computedEditItem,
where: {id: id}
}
}
})
await window.vtoast.success("修改学生成功");
this.isEditDrawerShow = false;
await this.getTableData();
}
},
getConstantCollectionItemText(key, _value) {
const constantCollectionItemFind = this.constantCollection[key].find(({value}) => value === _value);
if(constantCollectionItemFind) {
return constantCollectionItemFind.text;
}
return _value;
}
}
})
</script>
<style scoped>
</style>
{% endblock %}
+135
View File
@@ -0,0 +1,135 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>
江湖演示-初级-数据传输演示
</title>
<meta charset="utf-8" name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"/>
<script src="/xianfeng-v1/public/js/lib/axios.min.js"></script>
<script type="text/javascript">
async function insertStudent() {
// Tip: studentId不能重复
const studentInfo = {
studentId: "G00003",
bodyHeight: "180",
classId: "2021-01级-02班",
dateOfBirth: "2022-01-25",
gender: "male",
level: "02",
name: "小虾米",
remarks: "小虾米",
studentStatus: "正常",
}
const result = await axios({
method: 'post',
url: `/xianfeng-v1/resource`,
data: {
packageId: '123456',
packageType: 'httpRequest',
appData: {
appId: 'xianfeng-v1',
pageId: 'protocolDemo',
actionId: 'insertItem',
userAgent: 'demo_userAgent',
authToken: localStorage.getItem(`xianfeng-v1_authToken`),
actionData: studentInfo,
}
}
});
console.log('insertStudent', result.data);
}
async function selectStudentList() {
const result = await axios({
method: 'post',
url: `/xianfeng-v1/resource`,
data: {
packageId: '123456',
packageType: 'httpRequest',
appData: {
appId: 'xianfeng-v1',
pageId: 'protocolDemo',
actionId: 'selectItemList',
userAgent: 'demo_userAgent',
authToken: localStorage.getItem(`xianfeng-v1_authToken`),
actionData: {},
where: {},
}
}
});
console.log('selectStudentList', result.data);
}
async function updateStudent() {
const studentInfo = {
level: "03",
}
const result = await axios({
method: 'post',
url: `/xianfeng-v1/resource`,
data: {
packageId: '123456',
packageType: 'httpRequest',
appData: {
appId: 'xianfeng-v1',
pageId: 'protocolDemo',
actionId: 'updateItem',
userAgent: 'demo_userAgent',
authToken: localStorage.getItem(`xianfeng-v1_authToken`),
actionData: studentInfo,
where: {
studentId: "G00003",
},
}
}
});
console.log('updateStudent', result.data);
}
async function deleteStudent() {
const result = await axios({
method: 'post',
url: `/xianfeng-v1/resource`,
data: {
packageId: '123456',
packageType: 'httpRequest',
appData: {
appId: 'xianfeng-v1',
pageId: 'protocolDemo',
actionId: 'deleteItem',
userAgent: 'demo_userAgent',
authToken: localStorage.getItem(`xianfeng-v1_authToken`),
actionData: {},
where: {
studentId: "G00003",
},
}
}
});
console.log('deleteStudent', result.data);
}
</script>
</head>
<a href="/">回到首页</a><p/>
<button onclick="insertStudent()">1. 创建一个学号 "G00003", 姓名 "小虾米" 的二年级学生</button><p/>
<button onclick="selectStudentList()">2. 点击获取学生列表,显示在console里</button><p/>
<button onclick="updateStudent()">3. 将学生 "G00003" 改为三年级(level = 3)</button><p/>
<button onclick="deleteStudent()">4. 删除刚才创建的学生 "G00003"</button><p/>
<body>
</body>
+318
View File
@@ -0,0 +1,318 @@
{% extends 'template/jhTemplate.html'%}
{% block vue_template %}
<jh-layout>
<!-- 页面主要内容 -->
<v-container class="fullScreen d-flex flex-column pa-xs-0 pa-0">
<v-row class="ma-0 pa-xs-4 align-center flex-none pt-0 " :class="{'pa-4': !isMobile, 'pb-0': !isMobile, 'pa-2': isMobile}">
<v-col cols="12" xs="4" sm="4" md="4" xl="4" class="pl-0">
<v-btn color="success" small dark class="elevation-0 mr-2" @click="doUiAction('startCreateItem', null)">新增</v-btn>
<span class="body-2">共{{ tableData.length }}条记录</span>
</v-col>
<v-spacer></v-spacer>
<v-col cols="12" xs="8" sm="3" md="2" xl="2" class="pa-xs-0 pa-xs-2 col-sm-8-flex pl-0">
<v-select class="cus-v-input mr-2" v-model="currentTableGenderType" :items="[{value: 'all', text: '全部'}, ...constantCollection.gender]"
prefix="性别:" dense item-text="text" item-value="value" dense outlined></v-select>
</v-col>
<v-col cols="12" xs="8" sm="4" md="3" xl="3" class="pa-xs-0 pa-xs-2 col-sm-8-flex">
<v-text-field v-model="searchInput" label="表格过滤" class="cus-v-input" dense outlined></v-text-field>
</v-col>
</v-row>
<v-data-table fixed-header
:headers="headers"
:items="tableData"
:search="searchInput"
:footer-props="{ itemsPerPageOptions: [20, 40, 60, 100, -1] }"
:items-per-page="20"
mobile-breakpoint="0"
:loading="isTableLoading"
checkbox-color="success"
class="elevation-0 mt-0 mb-xs-4 flex-fill d-flex flex-column">
<template v-slot:item.gender="{ item }">
{{ getConstantCollectionItemText('gender', item.gender) }}
</template>
<template v-slot:item.level="{ item }">
{{ getConstantCollectionItemText('level', item.level) }}
</template>
<template v-slot:item.action="{ item }">
<v-btn small class="mr-2 success" @click="doUiAction('startUpdateItem', item)">
修改
</v-btn>
<v-btn small class="mr-2 error" @click="doUiAction('deleteItem', item)">
删除
</v-btn>
</template>
</v-data-table>
</v-container>
<!-- 编辑抽屉 -->
<v-navigation-drawer v-model="isEditDrawerShow" absolute temporary right width="80%" hide-overlay
v-click-outside="{ closeConditional: () => !dialogIsOpen(), }"
class="elevation-24">
<v-form v-model="isFormValid" v-if="isEditDrawerShow" ref="form" lazy-validation>
<v-row>
<span class="title pa-6">{{ editItem.id ? "修改" : "新增" }}信息</span>
<v-spacer></v-spacer>
<v-btn class="mt-7 mr-8 elevation-0" fab x-small @click="isEditDrawerShow = false">
<v-icon dark>mdi-close</v-icon>
</v-btn>
</v-row>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生ID 后端生成" v-model="editItem.studentId"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="班级ID" v-model="editItem.classId" :items="constantCollection.classId" :rules="requireRules"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生名字" v-model="editItem.name" :rules="requireRules"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="年级" v-model="editItem.level" :items="constantCollection.level" :rules="requireRules"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="性别" v-model="editItem.gender" :items="constantCollection.gender" :rules="requireRules"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-menu class="cus-v-input mr-2" offset-y max-width="290">
<template v-slot:activator="{ on, attrs }">
<v-text-field class="cus-v-input mr-2" dense outlined v-on="on" label="出生日期" v-model="editItem.dateOfBirth" :rules="requireRules"></v-text-field>
</template>
<v-date-picker color="success" elevation="20" v-model="editItem.dateOfBirth"></v-date-picker>
</v-menu>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="身高" v-model="editItem.bodyHeight"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="学生状态" v-model="editItem.studentStatus" :items="constantCollection.studentStatus"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="备注" v-model="editItem.remarks"></v-text-field>
</v-col>
</v-row>
<v-row class="justify-end pr-6">
<v-btn color="success" small @click="doUiAction(dialogSaveInfoAction)" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mb-2': isMobile, 'mr-4': isMobile}">保存</v-btn>
<v-btn class="ml-2" small @click="isEditDrawerShow = false" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mr-4': isMobile}">取消</v-btn>
</v-row>
</v-form>
</v-navigation-drawer>
</jh-layout>
{% endblock %}
{% block vue_body %}
<script type="module">
window.registerData({
// 表格相关数据
isFormValid: true,
requireRules: [
v => !!v || 'This is required',
],
constantCollection: {
gender: [{"value": "male", "text": "男"}, {"value": "female", "text": "女"}],
classId: [
{"value": "2021-01级-01班", "text": "2021-01级-01班"}, {"value": "2021-01级-02班", "text": "2021-01级-02班"},
{"value": "2021-02级-01班", "text": "2021-02级-01班"}, {"value": "2021-02级-02班", "text": "2021-02级-02班"},
{"value": "2021-03级-01班", "text": "2021-03级-01班"}, {"value": "2021-03级-02班", "text": "2021-03级-02班"}
],
level: [{"value": "01", "text": "一年级"}, {"value": "02", "text": "二年级"}, {"value": "03", "text": "三年级"}],
icType: [{"value": "身份证", "text": "身份证"}, {"value": "护照", "text": "护照"}],
enrollmentType: [{"value": "正常升学", "text": "正常升学"}, {"value": "借读", "text": "借读"}],
studentStatus: [{"value": "正常", "text": "正常"}, {"value": "退学", "text": "退学"}]
},
currentTableGenderType: 'all',
isEditDrawerShow: false,
searchInput: null,
isTableLoading: true,
tableDataFromBackend: [],
headers: [
{text: "学生ID", value: "studentId", width: 120, class: 'fixed', cellClass: 'fixed'},
{text: "班级ID", value: "classId", width: 140},
{text: "学生名字", value: "name", width: 120},
{text: "年级", value: "level", width: 120},
{text: "性别", value: "gender", width: 120},
{text: "出生日期", value: "dateOfBirth", width: 120},
{text: "身高", value: "bodyHeight", width: 120},
{text: "学生状态", value: "studentStatus", width: 120},
{text: "备注", value: "remarks", width: 120},
{text: "操作者", value: "operationByUser", width: 120},
{text: "操作时间", value: "operationAt", width: 250},
{text: '操作', value: 'action', align: 'center', sortable: false, width: 200, class: 'fixed', cellClass: 'fixed'},
],
editItem: {},
})
</script>
{% include 'layout/jhLayout.html' %}
{% include 'common/resetTableMaxHeight.html' %}
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vueComponent: 'page',
vuetify: new Vuetify(),
mixins: [window.jianghuUiActionMixins],
data: () => window.vueData,
computed: {
isMobile() {
return window.innerWidth < 600;
},
tableData() {
if (!this.currentTableGenderType || this.currentTableGenderType === 'all') {
return this.tableDataFromBackend;
}
return this.tableDataFromBackend.filter(({gender}) => gender === this.currentTableGenderType);
},
computedEditItem() {
return this.editItem;
},
},
watch: {},
mounted() {
this.doUiAction('refreshTableData')
},
methods: {
/**
* 获取表格数据
*/
async refreshTableData() {
this.isTableLoading = true;
const result = await window.jianghuAxios({
data: {
appData: {
pageId: 'resourceHook',
actionId: 'selectItemList',
actionData: {},
where: {},
orderBy: [{column: 'operationAt', order: 'desc'}]
}
}
});
this.tableDataFromBackend = result.data.appData.rows;
this.isTableLoading = false;
},
async clearItemData() {
this.editItem = {};
},
async openCreateDialog() {
this.isEditDrawerShow = true;
this.dialogSaveInfoAction = "createItem";
},
// createItem
async confirmCreateItemDialog() {
return await window.confirmDialog({ title: "新增", content: "确定新增吗?" });
},
/**
* 新增学生
*/
async doCreateItem() {
delete this.computedEditItem.id;
await window.vtoast.loading("新增学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'resourceHook',
actionId: 'insertItem',
actionData: this.computedEditItem
}
}
})
await window.vtoast.success("新增学生成功");
},
// createItem/updateItem
async closeDrawerShow() {
this.isEditDrawerShow = false;
},
async prepareItemData(item) {
this.editItem = {...item};
},
async openUpdateDialog() {
this.isEditDrawerShow = true;
this.dialogSaveInfoAction = "updateItem";
},
// validate
prepareValidate() {
return this.$refs.form.validate();
},
// createItem
async confirmUpdateItemDialog() {
return await window.confirmDialog({ title: "修改", content: "确定修改吗?" });
},
/**
* 新增学生
*/
async doUpdateItem() {
const id = this.computedEditItem.id;
delete this.computedEditItem.id;
await window.vtoast.loading("修改学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'resourceHook',
actionId: 'updateItem',
actionData: this.computedEditItem,
where: {id: id}
}
}
})
await window.vtoast.success("修改学生成功");
},
async confirmDeleteItemDialog() {
await window.confirmDialog({ title: '删除', content: '确定删除吗?'});
},
/**
* 删除学生
*/
async doDeleteItem() {
const { id } = this.computedEditItem;
await window.vtoast.loading("删除学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'resourceHook',
actionId: 'deleteItem',
actionData: {},
where: { id: id }
}
}
});
await window.vtoast.success("删除学生成功");
},
getConstantCollectionItemText(key, _value) {
const constantCollectionItemFind = this.constantCollection[key].find(({value}) => value === _value);
if(constantCollectionItemFind) {
return constantCollectionItemFind.text;
}
return _value;
},
dialogIsOpen() {
return window.dialogIsOpen;
}
}
})
</script>
<style scoped>
</style>
{% endblock %}
+332
View File
@@ -0,0 +1,332 @@
{% extends 'template/jhTemplate.html'%}
{% block vue_template %}
<jh-layout>
<!-- 页面主要内容 -->
<v-container class="fullScreen d-flex flex-column pa-xs-0 pa-0">
<v-row class="ma-0 pa-xs-4 align-center flex-none pt-0 " :class="{'pa-4': !isMobile, 'pb-0': !isMobile, 'pa-2': isMobile}">
<v-col cols="12" xs="4" sm="4" md="4" xl="4" class="pl-0">
<v-btn color="success" small dark class="elevation-0 mr-2" @click="doUiAction('startInsertItem')">新增</v-btn>
<span class="body-2">共{{ tableDataFromBackend.length }}条记录</span>
</v-col>
<v-spacer></v-spacer>
<v-col cols="12" xs="8" sm="4" md="3" xl="3" class="pa-xs-0 pa-xs-2 col-sm-8-flex">
<v-text-field v-model="searchInput" label="表格过滤" class="cus-v-input" dense outlined></v-text-field>
</v-col>
</v-row>
<v-data-table
fixed-header
:headers="headers"
:items="tableDataFromBackend"
:search="searchInput"
:footer-props="{ itemsPerPageOptions: [20, 40, 60, 100, -1] }"
:items-per-page="20"
mobile-breakpoint="0"
:loading="isTableLoading"
checkbox-color="success"
class="elevation-0 mt-0 mb-xs-4 flex-fill d-flex flex-column">
<template v-slot:item.action="{ item }">
<v-btn small class="mr-2 success" @click="doUiAction('startUpdateItem', {item})">
修改
</v-btn>
<v-btn small class="mr-2 error" @click="doUiAction('deleteItem', {item})">
删除
</v-btn>
</template>
</v-data-table>
</v-container>
<v-navigation-drawer v-model="isCreateDrawerShow" absolute temporary right width="80%" hide-overlay
v-click-outside="{ closeConditional: () => !dialogIsOpen(), }"
class="elevation-24">
<v-form v-model="isFormValid" v-if="isCreateDrawerShow" ref="form" lazy-validation>
<v-row>
<span class="title pa-6">新增</span>
<v-spacer></v-spacer>
<v-btn class="mt-7 mr-8 elevation-0" fab x-small @click="isCreateDrawerShow = false">
<v-icon dark>mdi-close</v-icon>
</v-btn>
</v-row>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生ID" v-model="createItem.studentId" :rules="requireRules"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="班级ID" v-model="createItem.classId"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生名字" v-model="createItem.name"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="年级" v-model="createItem.level"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="性别" v-model="createItem.gender"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-menu class="cus-v-input mr-2" offset-y max-width="290">
<template v-slot:activator="{ on, attrs }">
<v-text-field class="cus-v-input mr-2" dense outlined v-on="on" label="出生日期" v-model="createItem.dateOfBirth"></v-text-field>
</template>
<v-date-picker color="success" elevation="20" v-model="createItem.dateOfBirth"></v-date-picker>
</v-menu>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="身高" v-model="createItem.bodyHeight"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生状态" v-model="createItem.studentStatus"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="备注" v-model="createItem.remarks"></v-text-field>
</v-col>
</v-row>
<v-row class="justify-end pr-6">
<v-btn class="ml-2 success" small @click="doUiAction('createItem')" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mb-2': isMobile, 'mr-4': isMobile}">新增</v-btn>
<v-btn class="ml-2" small @click="isCreateDrawerShow = false" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mr-4': isMobile}">取消</v-btn>
</v-row>
</v-form>
</v-navigation-drawer>
<v-navigation-drawer v-model="isUpdateDrawerShow" absolute temporary right width="80%" hide-overlay
v-click-outside="{ closeConditional: () => !dialogIsOpen(), }"
class="elevation-24">
<v-form v-model="isFormValid" v-if="isUpdateDrawerShow" ref="form" lazy-validation>
<v-row>
<span class="title pa-6">修改</span>
<v-spacer></v-spacer>
<v-btn class="mt-7 mr-8 elevation-0" fab x-small @click="isUpdateDrawerShow = false">
<v-icon dark>mdi-close</v-icon>
</v-btn>
</v-row>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生ID" disabled v-model="updateItem.studentId" :rules="requireRules"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="班级ID" v-model="updateItem.classId"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生名字" v-model="updateItem.name"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="年级" v-model="updateItem.level"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="性别" v-model="updateItem.gender"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-menu class="cus-v-input mr-2" offset-y max-width="290">
<template v-slot:activator="{ on, attrs }">
<v-text-field class="cus-v-input mr-2" dense outlined v-on="on" label="出生日期" v-model="updateItem.dateOfBirth"></v-text-field>
</template>
<v-date-picker color="success" elevation="20" v-model="updateItem.dateOfBirth"></v-date-picker>
</v-menu>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="身高" v-model="updateItem.bodyHeight"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生状态" v-model="updateItem.studentStatus"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="备注" v-model="updateItem.remarks"></v-text-field>
</v-col>
</v-row>
<v-row class="justify-end pr-6">
<v-btn class="ml-2 success" color="success" small @click="doUiAction('updateItem')" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mb-2': isMobile, 'mr-4': isMobile}">修改</v-btn>
<v-btn class="ml-2" small @click="isUpdateDrawerShow = false" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mr-4': isMobile}">取消</v-btn>
</v-row>
</v-form>
</v-navigation-drawer>
</jh-layout>
{% endblock %}
{% block vue_body %}
{% include 'layout/jhLayout.html' %}
{% include 'common/resetTableMaxHeight.html' %}
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vueComponent: 'page',
vuetify: new Vuetify(),
mixins: [window.jianghuUiActionMixins],
data: {
// 表格相关数据
isFormValid: true,
requireRules: [
v => !!v || 'This is required',
],
searchInput: null,
isTableLoading: true,
tableDataFromBackend: [],
headers: [
{text: "学生ID", value: "studentId", width: 120, class: 'fixed', cellClass: 'fixed'},
{text: "班级ID", value: "classId", width: 140},
{text: "学生名字", value: "name", width: 120},
{text: "年级", value: "level", width: 120},
{text: "性别", value: "gender", width: 120},
{text: "出生日期", value: "dateOfBirth", width: 120},
{text: "身高", value: "bodyHeight", width: 120},
{text: "学生状态", value: "studentStatus", width: 120},
{text: "备注", value: "remarks", width: 120},
{text: "操作者", value: "operationByUser", width: 120},
{text: "操作时间", value: "operationAt", width: 250},
{text: '操作', value: 'action', align: 'center', sortable: false, width: 200, class: 'fixed', cellClass: 'fixed'},
],
isCreateDrawerShow: false,
createItem: {},
isUpdateDrawerShow: false,
updateItem: {},
},
computed: {
isMobile() {
return window.innerWidth < 600;
},
},
watch: {},
mounted() {
this.doUiAction('refreshTableData');
},
methods: {
async refreshTableData() {
this.isTableLoading = true;
const result = await window.jianghuAxios({
data: {
appData: {
pageId: 'uiAction',
actionId: 'selectItemList',
actionData: {},
where: {},
orderBy: [{column: 'operationAt', order: 'desc'}]
}
}
});
this.tableDataFromBackend = result.data.appData.rows;
this.isTableLoading = false;
},
// ====================================Create Start===========================================
async clearCreateForm() {
this.createItem = {};
},
// validate
prepareValidate() {
return this.$refs.form.validate();
},
async openCreateDrawer() {
this.isCreateDrawerShow = true;
},
async prepareCreateItem() {
delete this.createItem.id;
},
async confirmCreateFormDialog() {
// retrun false 会中断后面的 uiAction function
return await window.confirmDialog({ title: "新增", content: "确定新增吗?" });
},
async doCreateItem() {
await window.vtoast.loading("新增学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'uiAction',
actionId: 'createItem',
actionData: this.createItem
}
}
})
await window.vtoast.success("新增学生成功");
},
async closeCreateDrawer() {
this.isCreateDrawerShow = false;
},
// ====================================Create End===========================================
// ====================================Update Start===========================================
async fillUpdateForm({ item }) {
this.updateItem = _.clone(item);
},
async openUpdateDrawer() {
this.isUpdateDrawerShow = true;
},
async prepareUpdateItem() {
// TODO: 对this.updateItem做一些数据处理
},
async confirmUpdateItemDialog() {
// retrun false 会中断后面的 uiAction function
return await window.confirmDialog({ title: "修改", content: "确定修改吗?" });
},
async doUpdateItem() {
const {id, ...actionData} = this.updateItem;
await window.vtoast.loading("修改学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'uiAction',
actionId: 'updateItem',
actionData: actionData,
where: {id}
}
}
})
await window.vtoast.success("修改学生成功");
},
async closeUpdateDrawer() {
this.isUpdateDrawerShow = false;
},
// ====================================Update End===========================================
// ====================================Create Start===========================================
async confirmDeleteItemDialog({ item }) {
if (!item || !item.id) {
window.vtoast.fail("数据异常");
return
}
return await window.confirmDialog({ title: "删除", content: "确定删除吗?" });
},
async doDeleteItem({ item }) {
const { id } = item;
await window.vtoast.loading("删除学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'uiAction',
actionId: 'deleteItem',
actionData: {},
where: { id }
}
}
});
await window.vtoast.success("删除学生成功");
},
// ====================================Update End===========================================
dialogIsOpen() {
return window.dialogIsOpen;
},
}
})
</script>
<style scoped>
</style>
{% endblock %}
+327
View File
@@ -0,0 +1,327 @@
{% extends 'template/jhTemplate.html'%}
{% block vue_template %}
<jh-layout>
<!-- 页面主要内容 -->
<v-container class="fullScreen d-flex flex-column pa-xs-0 pa-0">
<v-row class="ma-0 pa-xs-4 align-center flex-none pt-0 " :class="{'pa-4': !isMobile, 'pb-0': !isMobile, 'pa-2': isMobile}">
<v-col cols="12" xs="4" sm="4" md="4" xl="4" class="pl-0">
<v-btn color="success" small dark class="elevation-0 mr-2" @click="doUiAction('startCreateItem')">新增</v-btn>
<span class="body-2">共{{ tableData.length }}条记录</span>
</v-col>
<v-spacer></v-spacer>
<v-col cols="12" xs="8" sm="3" md="2" xl="2" class="pa-xs-0 pa-xs-2 col-sm-8-flex pl-0">
<classSelectDialog />
</v-col>
<v-col cols="12" xs="8" sm="3" md="2" xl="2" class="pa-xs-0 pa-xs-2 col-sm-8-flex pl-0">
<v-select class="cus-v-input mr-2" v-model="currentTableGenderType" :items="[{value: 'all', text: '全部'}, ...constantCollection.gender]"
prefix="性别:" dense item-text="text" item-value="value" dense outlined></v-select>
</v-col>
<v-col cols="12" xs="8" sm="4" md="3" xl="3" class="pa-xs-0 pa-xs-2 col-sm-8-flex">
<v-text-field v-model="searchInput" label="表格过滤" class="cus-v-input" dense outlined></v-text-field>
</v-col>
</v-row>
<v-data-table
fixed-header
:headers="headers"
:items="tableData"
:search="searchInput"
:footer-props="{ itemsPerPageOptions: [20, 40, 60, 100, -1] }"
:items-per-page="20"
mobile-breakpoint="0"
:loading="isTableLoading"
checkbox-color="success"
class="elevation-0 mt-0 mb-xs-4 flex-fill d-flex flex-column">
<template v-slot:item.gender="{ item }">
{{ getConstantCollectionItemText('gender', item.gender) }}
</template>
<template v-slot:item.level="{ item }">
{{ getConstantCollectionItemText('level', item.level) }}
</template>
<template v-slot:item.action="{ item }">
<v-btn small class="mr-2 success" @click="doUiAction('startUpdateItem', {item})">
修改
</v-btn>
<v-btn small class="mr-2 error" @click="doUiAction('deleteItem', {item})">
删除
</v-btn>
</template>
</v-data-table>
</v-container>
<!-- 编辑抽屉 -->
<v-navigation-drawer v-model="isEditDrawerShow" absolute temporary right width="80%" hide-overlay
v-click-outside="{ closeConditional: () => !dialogIsOpen(), }"
class="elevation-24">
<v-form v-model="isFormValid" v-if="isEditDrawerShow" ref="form" lazy-validation>
<v-row>
<span class="title pa-6">{{ editItem.id ? "修改" : "新增" }}信息</span>
<v-spacer></v-spacer>
<v-btn class="mt-7 mr-8 elevation-0" fab x-small @click="isEditDrawerShow = false">
<v-icon dark>mdi-close</v-icon>
</v-btn>
</v-row>
<v-row class="pa-0 ma-0 pa-xs-4 pb-xs-4 flex-none">
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生ID" v-model="editItem.studentId" :rules="requireRules"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="班级ID" v-model="editItem.classId" :items="constantCollection.classId"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="学生名字" v-model="editItem.name"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="年级" v-model="editItem.level" :items="constantCollection.level"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="性别" v-model="editItem.gender" :items="constantCollection.gender"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-menu class="cus-v-input mr-2" offset-y max-width="290">
<template v-slot:activator="{ on, attrs }">
<v-text-field class="cus-v-input mr-2" dense outlined v-on="on" label="出生日期" v-model="editItem.dateOfBirth"></v-text-field>
</template>
<v-date-picker color="success" elevation="20" v-model="editItem.dateOfBirth"></v-date-picker>
</v-menu>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="身高" v-model="editItem.bodyHeight"></v-text-field>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-select class="cus-v-input mr-2" dense outlined clearable label="学生状态" v-model="editItem.studentStatus" :items="constantCollection.studentStatus"></v-select>
</v-col>
<v-col cols="12" sm="12" md="4" xl="3" class="pa-xs-0 pb-xs-4 pb-3">
<v-text-field class="cus-v-input mr-2" dense outlined label="备注" v-model="editItem.remarks"></v-text-field>
</v-col>
</v-row>
<v-row class="justify-end pr-6">
<v-btn v-if="editItem.id" color="success" small @click="doUiAction('updateItem')" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mb-2': isMobile, 'mr-4': isMobile}">修改</v-btn>
<v-btn v-if="!editItem.id" small @click="doUiAction('insertItem')" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mb-2': isMobile, 'mr-4': isMobile}">创建</v-btn>
<v-btn class="ml-2" small @click="isEditDrawerShow = false" :style="{width: isMobile ? 'calc(100% - 45px)' : '200px'}" :class="{'mr-4': isMobile}">取消</v-btn>
</v-row>
</v-form>
</v-navigation-drawer>
</jh-layout>
{% endblock %}
{% block vue_body %}
<script>
window.registerData({
// 组件的 数据
classSelectDialog_shown: false,
classSelectDialog_title: "班级",
classSelectDialog_selected: null,
classSelectDialog_filterText: null,
classSelectDialog_dataList: [
{ value: "2021-01级-01班", text: "2021-01级-01班" },
{ value: "2021-01级-02班", text: "2021-01级-02班" },
{ value: "2021-02级-01班", text: "2021-02级-01班" },
{ value: "2021-02级-02班", text: "2021-02级-02班" },
{ value: "2021-03级-01班", text: "2021-03级-01班" },
{ value: "2021-03级-02班", text: "2021-03级-02班" },
],
// page的 数据
isFormValid: true,
requireRules: [
v => !!v || 'This is required',
],
constantCollection: {
gender: [{"value": "male", "text": "男"}, {"value": "female", "text": "女"}],
classId: [
{"value": "2021-01级-01班", "text": "2021-01级-01班"}, {"value": "2021-01级-02班", "text": "2021-01级-02班"},
{"value": "2021-02级-01班", "text": "2021-02级-01班"}, {"value": "2021-02级-02班", "text": "2021-02级-02班"},
{"value": "2021-03级-01班", "text": "2021-03级-01班"}, {"value": "2021-03级-02班", "text": "2021-03级-02班"}
],
level: [{"value": "01", "text": "一年级"}, {"value": "02", "text": "二年级"}, {"value": "03", "text": "三年级"}],
icType: [{"value": "身份证", "text": "身份证"}, {"value": "护照", "text": "护照"}],
enrollmentType: [{"value": "正常升学", "text": "正常升学"}, {"value": "借读", "text": "借读"}],
studentStatus: [{"value": "正常", "text": "正常"}, {"value": "退学", "text": "退学"}]
},
currentTableGenderType: 'all',
isEditDrawerShow: false,
searchInput: null,
isTableLoading: true,
tableDataFromBackend: [],
headers: [
{text: "学生ID", value: "studentId", width: 120, class: 'fixed', cellClass: 'fixed'},
{text: "班级ID", value: "classId", width: 140},
{text: "学生名字", value: "name", width: 120},
{text: "年级", value: "level", width: 120},
{text: "性别", value: "gender", width: 120},
{text: "出生日期", value: "dateOfBirth", width: 120},
{text: "身高", value: "bodyHeight", width: 120},
{text: "学生状态", value: "studentStatus", width: 120},
{text: "备注", value: "remarks", width: 120},
{text: "操作者", value: "operationByUser", width: 120},
{text: "操作时间", value: "operationAt", width: 250},
{text: '操作', value: 'action', align: 'center', sortable: false, width: 200, class: 'fixed', cellClass: 'fixed'},
],
editItem: {},
})
</script>
{% include 'layout/jhLayout.html' %}
{% include 'common/resetTableMaxHeight.html' %}
{% include 'component/classSelectDialog.html' %}
<script type="module">
new Vue({
el: '#app',
template: '#app-template',
vueComponent: 'page',
vuetify: new Vuetify(),
mixins: [window.jianghuUiActionMixins],
data: window.vueData,
computed: {
isMobile() {
return window.innerWidth < 600;
},
tableData() {
let dataList = this.tableDataFromBackend;
if (this.currentTableGenderType && this.currentTableGenderType !== 'all') {
dataList = dataList.filter(({gender}) => gender === this.currentTableGenderType);
}
if (this.classSelectDialog_selected) {
dataList = dataList.filter(({classId}) => classId === this.classSelectDialog_selected);
}
return dataList;
},
},
watch: {},
mounted() {
this.doUiAction('refreshTableData');
},
methods: {
async refreshTableData() {
this.isTableLoading = true;
const result = await window.jianghuAxios({
data: {
appData: {
pageId: 'uiActionComponent',
actionId: 'selectItemList',
actionData: {},
where: {},
orderBy: [{column: 'operationAt', order: 'desc'}]
}
}
});
this.tableDataFromBackend = result.data.appData.rows;
this.isTableLoading = false;
},
async clearItemData() {
this.editItem = {};
},
// validate
prepareValidate() {
return this.$refs.form.validate();
},
async openCreateDialog() {
this.isEditDrawerShow = true;
},
async prepareCreateItem() {
delete this.editItem.id;
},
async doCreateItem() {
await window.vtoast.loading("新增学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'uiActionComponent',
actionId: 'insertItem',
actionData: this.editItem
}
}
})
await window.vtoast.success("新增学生成功");
},
async closeDrawerShow() {
this.isEditDrawerShow = false;
},
async prepareItemData({item}) {
this.editItem = { ...item };
},
async openUpdateDialog() {
this.isEditDrawerShow = true;
},
async doUpdateItem() {
const {id, ...actionData} = this.editItem;
await window.vtoast.loading("修改学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'uiActionComponent',
actionId: 'updateItem',
actionData: actionData,
where: {id}
}
}
})
await window.vtoast.success("修改学生成功");
},
async confirmDeleteItemDialog() {
return await window.confirmDialog({ title: "删除", content: "确定删除吗?" });
},
async doDeleteItem() {
const {id} = this.editItem;
await window.vtoast.loading("删除学生");
await window.jianghuAxios({
data: {
appData: {
pageId: 'uiActionComponent',
actionId: 'deleteItem',
actionData: {},
where: {id: id}
}
}
});
await window.vtoast.success("删除学生成功");
},
getConstantCollectionItemText(key, _value) {
const constantCollectionItemFind = this.constantCollection[key].find(
({ value }) => value === _value
);
if (constantCollectionItemFind) {
return constantCollectionItemFind.text;
}
return _value;
},
dialogIsOpen() {
return window.dialogIsOpen;
},
}
})
</script>
<style scoped>
</style>
{% endblock %}
+3
View File
@@ -0,0 +1,3 @@
## 服务端搜索(studentManagement04)
服务端搜索
+1
View File
@@ -0,0 +1 @@
# 选择部分数据的权限设置
+3
View File
@@ -0,0 +1,3 @@
## 前端对接(studentManagement02)
前端对接
+3
View File
@@ -0,0 +1,3 @@
## 前端优化(studentManagement03)
前端优化
+16
View File
@@ -0,0 +1,16 @@
<!-- 首页文档 -->
# jianghujs_demo_basic
本项目展示江湖 js 的基本功能。
## 标题1
## 标题2
## 标题3
## 标题4
+3
View File
@@ -0,0 +1,3 @@
## 应用协议(studentManagement01)
应用协议
+52
View File
@@ -0,0 +1,52 @@
'use strict';
const path = require('path');
const assert = require('assert');
const { middleware, middlewareMatch } = require('egg-jianghu/config/middlewareConfig');
const eggJianghuPathTemp = require.resolve('egg-jianghu');
const eggJianghuPath = path.join(eggJianghuPathTemp, '../');
module.exports = appInfo => {
assert(appInfo);
const appId = 'xianfeng-v1';
const uploadDir = path.join(appInfo.baseDir, 'upload');
const downloadBasePath = `/${appId}/upload`;
return {
appId,
appTitle: '先锋v1',
appLogo: `${appId}/public/img/logo.png`,
appType: 'single',
appDirectoryLink: '/',
indexPage: `/${appId}/page/manual`,
loginPage: `/${appId}/page/login`,
helpPage: `/${appId}/page/help`,
uploadDir,
downloadBasePath,
static: {
maxAge: 0,
buffer: false,
preload: false,
maxFiles: 0,
dir: [
{ prefix: `/${appId}/public/`, dir: path.join(appInfo.baseDir, 'app/public') },
{ prefix: `/${appId}/public/`, dir: path.join(eggJianghuPath, 'app/public') },
{ prefix: `/${appId}/upload/`, dir: uploadDir },
],
},
view: {
defaultViewEngine: 'nunjucks',
mapping: { '.html': 'nunjucks' },
root: [
path.join(appInfo.baseDir, 'app/view'),
path.join(eggJianghuPath, 'app/view'),
].join(','),
},
middleware,
...middlewareMatch,
};
};
+40
View File
@@ -0,0 +1,40 @@
'use strict';
const path = require('path');
module.exports = appInfo => {
return {
static: {
maxAge: 0,
buffer: false,
preload: false,
maxFiles: 0,
},
logger: {
outputJSON: true,
consoleLevel: 'DEBUG',
level: 'DEBUG',
dir: path.join(appInfo.baseDir, 'logs'),
contextFormatter(meta) {
return `[${meta.date}] [${meta.level}] [${meta.ctx.method} ${meta.ctx.url}] ${meta.message}`;
}
},
knex: {
client: {
dialect: 'mysql',
connection: {
host: '127.0.0.1',
port: 3306,
user: 'root',
password: '123456',
database: 'xianfeng-v1'
},
pool: { min: 0, max: 30 },
acquireConnectionTimeout: 30000
},
app: true
}
};
};
+40
View File
@@ -0,0 +1,40 @@
'use strict';
const path = require('path');
module.exports = appInfo => {
return {
static: {
maxAge: 0,
buffer: false,
preload: false,
maxFiles: 0,
},
logger: {
outputJSON: true,
level: 'INFO',
// level: 'DEBUG',
// allowDebugAtProd: true,
dir: path.join(appInfo.baseDir, 'logs'),
contextFormatter(meta) {
return `[${meta.date}] [${meta.level}] [${meta.ctx.method} ${meta.ctx.url}] ${meta.message}`;
}
},
knex: {
client: {
dialect: 'mysql',
connection: {
host: '127.0.0.1',
port: '3306',
user: 'root',
password: '123456',
database: 'xianfeng-v1'
},
pool: { min: 0, max: 30 },
acquireConnectionTimeout: 30000
},
app: true
}
};
};
+23
View File
@@ -0,0 +1,23 @@
'use strict';
module.exports = appInfo => {
return {
knex: {
client: {
dialect: 'mysql',
connection: {
host: '127.0.0.1',
port: '3306',
user: 'root',
password: '123456',
database: 'xianfeng-v1'
},
pool: { min: 0, max: 30 },
acquireConnectionTimeout: 30000,
},
app: true,
},
};
};
+5
View File
@@ -0,0 +1,5 @@
'use strict';
/** @type Egg.EggPlugin */
module.exports = {
};
+5
View File
@@ -0,0 +1,5 @@
{
"include": [
"**/*"
]
}
+45
View File
@@ -0,0 +1,45 @@
{
"name": "xianfeng-v1",
"version": "1.0.0",
"description": "",
"private": true,
"egg": {
"declarations": true,
"framework": "egg-jianghu"
},
"dependencies": {
"egg": "^2.15.1",
"egg-jianghu": "2.0.10",
"egg-scripts": "^2.11.0"
},
"devDependencies": {
"autod": "^3.0.1",
"autod-egg": "^1.1.0",
"egg-bin": "^4.11.0",
"egg-mock": "^3.21.0",
"eslint": "^7.32.0",
"eslint-config-egg": "^7.1.0",
"eslint-plugin-jsdoc": "^37.6.1"
},
"engines": {
"node": ">=10.0.0"
},
"scripts": {
"start": "egg-scripts start --daemon --port=9501 --title=xianfeng-v1",
"stop": "egg-scripts stop --title=xianfeng-v1",
"dev": "egg-bin dev --port=9501",
"debug": "egg-bin debug",
"test": "npm run lint -- --fix && npm run test-local",
"test-local": "egg-bin test",
"cov": "egg-bin cov",
"lint": "eslint .",
"ci": "npm run lint && npm run cov",
"autod": "autod"
},
"repository": {
"type": "git",
"url": ""
},
"author": "",
"license": "MIT"
}
+628
View File
@@ -0,0 +1,628 @@
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: _cache
# ------------------------------------------------------------
DROP TABLE IF EXISTS `_cache`;
CREATE TABLE `_cache` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userId` varchar(255) NOT NULL COMMENT '用户Id',
`content` longtext COMMENT '缓存数据',
`recordStatus` varchar(255) DEFAULT 'active',
`operation` varchar(255) DEFAULT 'insert' COMMENT '操作; insert, update, jhInsert, jhUpdate, jhDelete jhRestore',
`operationByUserId` varchar(255) DEFAULT NULL COMMENT '操作者userId',
`operationByUser` varchar(255) DEFAULT NULL COMMENT '操作者用户名',
`operationAt` varchar(255) DEFAULT NULL COMMENT '操作时间; E.g: 2021-05-28T10:24:54+08:00 ',
PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 17 COMMENT = '缓存表';
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: _constant
# ------------------------------------------------------------
DROP TABLE IF EXISTS `_constant`;
CREATE TABLE `_constant` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`constantKey` varchar(255) DEFAULT NULL,
`constantType` varchar(255) DEFAULT NULL COMMENT '常量类型; object, array',
`desc` varchar(255) DEFAULT NULL COMMENT '描述',
`constantValue` text COMMENT '常量内容; object, array',
`operation` varchar(255) DEFAULT 'insert' COMMENT '操作; insert, update, jhInsert, jhUpdate, jhDelete jhRestore',
`operationByUserId` varchar(255) DEFAULT NULL COMMENT '操作者userId',
`operationByUser` varchar(255) DEFAULT NULL COMMENT '操作者用户名',
`operationAt` varchar(255) DEFAULT NULL COMMENT '操作时间; E.g: 2021-05-28T10:24:54+08:00 ',
PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 59 COMMENT = '常量表; 软删除未启用;';
# ------------------------------------------------------------
# DATA DUMP FOR TABLE: _constant
# ------------------------------------------------------------
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: _file
# ------------------------------------------------------------
DROP TABLE IF EXISTS `_file`;
CREATE TABLE `_file` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`fileId` varchar(255) DEFAULT NULL COMMENT 'fileId',
`fileDirectory` varchar(255) DEFAULT NULL COMMENT '文件保存路径;',
`filename` varchar(255) DEFAULT NULL COMMENT '文件名;',
`filenameStorage` varchar(255) DEFAULT NULL COMMENT '文件保存名',
`downloadPath` varchar(255) DEFAULT NULL COMMENT '文件下载路径',
`fileType` varchar(255) DEFAULT NULL COMMENT '文件类型;(预留字段)',
`fileDesc` varchar(255) DEFAULT NULL COMMENT '文件描述',
`binarySize` varchar(255) DEFAULT NULL COMMENT '文件二进制大小',
`operation` varchar(255) DEFAULT 'insert' COMMENT '操作; insert, update, jhInsert, jhUpdate, jhDelete jhRestore',
`operationByUserId` varchar(255) DEFAULT NULL COMMENT '操作者userId',
`operationByUser` varchar(255) DEFAULT NULL COMMENT '操作者用户名',
`operationAt` varchar(255) DEFAULT NULL COMMENT '操作时间; E.g: 2021-05-28T10:24:54+08:00 ',
PRIMARY KEY (`id`),
KEY `fileId_index` (`fileId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 12 COMMENT = '文件表; 软删除未启用;';
# ------------------------------------------------------------
# DATA DUMP FOR TABLE: _file
# ------------------------------------------------------------
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: _group
# ------------------------------------------------------------
DROP TABLE IF EXISTS `_group`;
CREATE TABLE `_group` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`groupId` varchar(255) NOT NULL COMMENT 'groupId',
`groupName` varchar(255) DEFAULT NULL COMMENT '群组名',
`groupDesc` varchar(255) DEFAULT NULL COMMENT '群组描述',
`groupAvatar` varchar(255) DEFAULT NULL COMMENT '群logo',
`groupExtend` varchar(1024) DEFAULT '{}' COMMENT '拓展字段; { groupNotice: ''xx'' }',
`operation` varchar(255) DEFAULT 'insert' COMMENT '操作; insert, update, jhInsert, jhUpdate, jhDelete jhRestore',
`operationByUserId` varchar(255) DEFAULT NULL COMMENT '操作者userId',
`operationByUser` varchar(255) DEFAULT NULL COMMENT '操作者用户名',
`operationAt` varchar(255) DEFAULT NULL COMMENT '操作时间; E.g: 2021-05-28T10:24:54+08:00 ',
PRIMARY KEY (`id`),
KEY `groupId_index` (`groupId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 COMMENT = '群组表; 软删除未启用;';
# ------------------------------------------------------------
# DATA DUMP FOR TABLE: _group
# ------------------------------------------------------------
INSERT INTO `_group` (`id`,`groupId`,`groupName`,`groupDesc`,`groupAvatar`,`groupExtend`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (1,'adminGroup','管理组','管理组',NULL,'{}','insert',NULL,NULL,NULL);
INSERT INTO `_group` (`id`,`groupId`,`groupName`,`groupDesc`,`groupAvatar`,`groupExtend`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (6,'wudang','武当','武当',NULL,'{}','insert',NULL,NULL,NULL);
INSERT INTO `_group` (`id`,`groupId`,`groupName`,`groupDesc`,`groupAvatar`,`groupExtend`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (7,'gaibang','丐帮','丐帮',NULL,'{}','insert',NULL,NULL,NULL);
INSERT INTO `_group` (`id`,`groupId`,`groupName`,`groupDesc`,`groupAvatar`,`groupExtend`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (8,'huashan','华山派','华山派',NULL,'{}','insert',NULL,NULL,NULL);
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: _page
# ------------------------------------------------------------
DROP TABLE IF EXISTS `_page`;
CREATE TABLE `_page` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pageId` varchar(255) DEFAULT NULL COMMENT 'pageId',
`pageName` varchar(255) DEFAULT NULL COMMENT 'page name',
`pageType` varchar(255) DEFAULT NULL COMMENT '页面类型; showInMenu, dynamicInMenu',
`sort` varchar(255) DEFAULT NULL,
`operation` varchar(255) DEFAULT 'insert' COMMENT '操作; insert, update, jhInsert, jhUpdate, jhDelete jhRestore',
`operationByUserId` varchar(255) DEFAULT NULL COMMENT '操作者userId',
`operationByUser` varchar(255) DEFAULT NULL COMMENT '操作者用户名',
`operationAt` varchar(255) DEFAULT NULL COMMENT '操作时间; E.g: 2021-05-28T10:24:54+08:00 ',
PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 36 COMMENT = '页面表; 软删除未启用;';
# ------------------------------------------------------------
# DATA DUMP FOR TABLE: _page
# ------------------------------------------------------------
INSERT INTO `_page` (`id`,`pageId`,`pageName`,`pageType`,`sort`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (2,'help','帮助','dynamicInMenu','11','insert',NULL,NULL,NULL);
INSERT INTO `_page` (`id`,`pageId`,`pageName`,`pageType`,`sort`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (3,'login','登陆','','','insert',NULL,NULL,NULL);
INSERT INTO `_page` (`id`,`pageId`,`pageName`,`pageType`,`sort`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (6,'manual','操作手册','showInMenu','0','insert',NULL,NULL,NULL);
INSERT INTO `_page` (`id`,`pageId`,`pageName`,`pageType`,`sort`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (25,'protocolDemo','应用协议','showInMenu','2','insert',NULL,NULL,NULL);
INSERT INTO `_page` (`id`,`pageId`,`pageName`,`pageType`,`sort`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (27,'frontendDemo01','前端对接','showInMenu','3','insert',NULL,NULL,NULL);
INSERT INTO `_page` (`id`,`pageId`,`pageName`,`pageType`,`sort`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (28,'frontendDemo02','前端-jianghuAxios','showInMenu','4','insert',NULL,NULL,NULL);
INSERT INTO `_page` (`id`,`pageId`,`pageName`,`pageType`,`sort`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (29,'resourceHook','前端-resouceHook','showInMenu','6','insert',NULL,NULL,NULL);
INSERT INTO `_page` (`id`,`pageId`,`pageName`,`pageType`,`sort`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (31,'backendSearchDemo','服务端搜索','showInMenu','7','insert',NULL,NULL,NULL);
INSERT INTO `_page` (`id`,`pageId`,`pageName`,`pageType`,`sort`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (32,'dataAccessRight','数据权限','showInMenu','8','insert',NULL,NULL,NULL);
INSERT INTO `_page` (`id`,`pageId`,`pageName`,`pageType`,`sort`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (34,'uiAction','uiAction','showInMenu','5','insert',NULL,NULL,NULL);
INSERT INTO `_page` (`id`,`pageId`,`pageName`,`pageType`,`sort`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (35,'uiActionComponent','uiAction-组件通信','showInMenu','5','insert',NULL,NULL,NULL);
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: _record_history
# ------------------------------------------------------------
DROP TABLE IF EXISTS `_record_history`;
CREATE TABLE `_record_history` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`table` varchar(255) DEFAULT NULL COMMENT '表',
`recordId` int(11) DEFAULT NULL COMMENT '数据在table中的主键id; recordContent.id',
`recordContent` json NOT NULL COMMENT '数据',
`packageContent` json NOT NULL COMMENT '当时请求的 package JSON',
`operation` varchar(255) DEFAULT NULL COMMENT '操作; jhInsert, jhUpdate, jhDelete jhRestore',
`operationByUserId` varchar(255) DEFAULT NULL COMMENT '操作者userId; recordContent.operationByUserId',
`operationByUser` varchar(255) DEFAULT NULL COMMENT '操作者用户名; recordContent.operationByUser',
`operationAt` varchar(255) DEFAULT NULL COMMENT '操作时间; recordContent.operationAt; E.g: 2021-05-28T10:24:54+08:00 ',
PRIMARY KEY (`id`),
KEY `index_record_id` (`recordId`),
KEY `index_table_action` (`table`, `operation`)
) ENGINE = InnoDB AUTO_INCREMENT = 2140 COMMENT = '数据历史表';
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: _resource
# ------------------------------------------------------------
DROP TABLE IF EXISTS `_resource`;
CREATE TABLE `_resource` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`accessControlTable` varchar(255) DEFAULT NULL COMMENT '数据规则控制表',
`resourceHook` json DEFAULT NULL COMMENT '[ "before": {"service": "xx", "serviceFunction": "xxx"}, "after": [] }',
`pageId` varchar(255) DEFAULT NULL COMMENT 'page id; E.g: index',
`actionId` varchar(255) DEFAULT NULL COMMENT 'action id; E.g: selectXXXByXXX',
`desc` varchar(255) DEFAULT NULL COMMENT '描述',
`resourceType` varchar(255) DEFAULT NULL COMMENT 'resource 类型; E.g: auth service sql',
`appDataSchema` json DEFAULT NULL COMMENT 'appData 参数校验',
`resourceData` json DEFAULT NULL COMMENT 'resource 数据; { "service": "auth", "serviceFunction": "passwordLogin" } or { "table": "${tableName}", "action": "select", "whereCondition": ".where(function() {this.whereNot( { recordStatus: \\"active\\" })})" }',
`requestDemo` json DEFAULT NULL COMMENT '请求Demo',
`responseDemo` json DEFAULT NULL COMMENT '响应Demo',
`operation` varchar(255) DEFAULT 'insert' COMMENT '操作; insert, update, jhInsert, jhUpdate, jhDelete jhRestore',
`operationByUserId` varchar(255) DEFAULT NULL COMMENT '操作者userId',
`operationByUser` varchar(255) DEFAULT NULL COMMENT '操作者用户名',
`operationAt` varchar(255) DEFAULT NULL COMMENT '操作时间; E.g: 2021-05-28T10:24:54+08:00 ',
PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 365 COMMENT = '请求资源表; 软删除未启用; resourceId=`${appId}.${pageId}.${actionId}`';
# ------------------------------------------------------------
# DATA DUMP FOR TABLE: _resource
# ------------------------------------------------------------
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (231,NULL,NULL,'login','passwordLogin','✅登陆','service','{}','{\"service\": \"user\", \"serviceFunction\": \"passwordLogin\"}',NULL,NULL,'update',NULL,NULL,'2022-04-27T15:32:57+08:00');
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (251,NULL,NULL,'allPage','logout','✅登出','service','{}','{\"service\": \"user\", \"serviceFunction\": \"logout\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (253,NULL,NULL,'allPage','userInfo','✅获取用户信息','service','{}','{\"service\": \"user\", \"serviceFunction\": \"userInfo\"}',NULL,NULL,'update',NULL,NULL,'2022-04-27T15:37:21+08:00');
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (258,NULL,NULL,'allPage','getConstantList','✅查询常量','sql','{}','{\"table\": \"_constant\", \"operation\": \"select\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (293,NULL,NULL,'protocolDemo','selectItemList','✅应用协议-查询列表','sql','{}','{\"table\": \"student\", \"operation\": \"select\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (294,NULL,NULL,'protocolDemo','insertItem','✅应用协议-添加成员','sql','{}','{\"table\": \"student\", \"operation\": \"insert\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (295,NULL,NULL,'protocolDemo','updateItem','✅应用协议-更新成员','sql','{}','{\"table\": \"student\", \"operation\": \"jhUpdate\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (296,NULL,NULL,'protocolDemo','deleteItem','✅应用协议-删除信息','sql','{}','{\"table\": \"student\", \"operation\": \"jhDelete\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (309,NULL,NULL,'frontendDemo01','selectItemList','✅前端对接-查询列表','sql','{}','{\"table\": \"student\", \"operation\": \"select\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (310,NULL,NULL,'frontendDemo01','insertItem','✅前端对接-添加成员','sql','{}','{\"table\": \"student\", \"operation\": \"insert\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (311,NULL,NULL,'frontendDemo01','updateItem','✅前端对接-更新成员','sql','{}','{\"table\": \"student\", \"operation\": \"jhUpdate\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (312,NULL,NULL,'frontendDemo01','deleteItem','✅前端对接-删除信息','sql','{}','{\"table\": \"student\", \"operation\": \"jhDelete\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (313,NULL,NULL,'frontendDemo02','selectItemList','✅前端优化-查询列表','sql','{}','{\"table\": \"student\", \"operation\": \"select\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (314,NULL,NULL,'frontendDemo02','insertItem','✅前端优化-添加成员','sql','{}','{\"table\": \"student\", \"operation\": \"jhInsert\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (315,NULL,NULL,'frontendDemo02','updateItem','✅前端优化-更新成员','sql','{}','{\"table\": \"student\", \"operation\": \"jhUpdate\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (316,NULL,NULL,'frontendDemo02','deleteItem','✅前端优化-删除信息','sql','{}','{\"table\": \"student\", \"operation\": \"jhDelete\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (317,NULL,NULL,'resourceHook','selectItemList','✅前端对接-业务ID-查询列表','sql','{}','{\"table\": \"student\", \"operation\": \"select\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (318,NULL,'{\"after\": [], \"before\": [{\"service\": \"student\", \"serviceFunction\": \"beforHookForGenerateStudentId\"}]}','resourceHook','insertItem','✅前端对接-业务ID-添加成员','sql','{\"type\": \"object\", \"required\": [\"actionData\"], \"properties\": {\"actionData\": {\"type\": \"object\", \"required\": [\"classId\", \"name\", \"level\", \"gender\", \"dateOfBirth\"], \"properties\": {\"name\": {\"type\": \"string\"}, \"level\": {\"anyOf\": [{\"type\": \"string\"}, {\"type\": \"number\"}]}, \"gender\": {\"type\": \"string\"}, \"classId\": {\"type\": \"string\"}, \"dateOfBirth\": {\"type\": \"string\", \"format\": \"date\"}}, \"additionalProperties\": true}}, \"additionalProperties\": true}','{\"table\": \"student\", \"operation\": \"jhInsert\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (319,NULL,NULL,'resourceHook','updateItem','✅前端对接-业务ID-更新成员','sql','{}','{\"table\": \"student\", \"operation\": \"jhUpdate\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (320,NULL,NULL,'resourceHook','deleteItem','✅前端对接-业务ID-删除信息','sql','{}','{\"table\": \"student\", \"operation\": \"jhDelete\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (325,NULL,NULL,'uiAction','selectItemList','✅前端规范-查询列表','sql','{}','{\"table\": \"student\", \"operation\": \"select\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (326,NULL,NULL,'uiAction','createItem','✅前端规范-添加成员','sql','{}','{\"table\": \"student\", \"operation\": \"jhInsert\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (327,NULL,NULL,'uiAction','updateItem','✅前端规范-更新成员','sql','{}','{\"table\": \"student\", \"operation\": \"jhUpdate\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (328,NULL,NULL,'uiAction','deleteItem','✅前端规范-删除信息','sql','{}','{\"table\": \"student\", \"operation\": \"jhDelete\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (331,NULL,NULL,'uiActionComponent','selectItemList','✅前端规范-组件通信-查询列表','sql','{}','{\"table\": \"student\", \"operation\": \"select\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (332,NULL,NULL,'uiActionComponent','insertItem','✅前端规范-组件通信-添加成员','sql','{}','{\"table\": \"student\", \"operation\": \"jhInsert\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (333,NULL,NULL,'uiActionComponent','updateItem','✅前端规范-组件通信-更新成员','sql','{}','{\"table\": \"student\", \"operation\": \"jhUpdate\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (334,NULL,NULL,'uiActionComponent','deleteItem','✅前端规范-组件通信-删除信息','sql','{}','{\"table\": \"student\", \"operation\": \"jhDelete\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (341,'access_control_student',NULL,'backendSearchDemo','selectItemList','✅服务端查询-查询列表','sql','{}','{\"table\": \"student\", \"operation\": \"select\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (342,NULL,NULL,'backendSearchDemo','insertItem','✅服务端查询-添加成员','sql','{}','{\"table\": \"student\", \"operation\": \"insert\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (343,NULL,NULL,'backendSearchDemo','updateItem','✅服务端查询-更新成员','sql','{}','{\"table\": \"student\", \"operation\": \"jhUpdate\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (350,NULL,NULL,'backendSearchDemo','deleteItem','✅服务端查询-删除信息','sql','{}','{\"table\": \"student\", \"operation\": \"jhDelete\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (352,NULL,NULL,'dataAccessRight','insertItem','✅数据权限-添加成员','sql','{}','{\"table\": \"student\", \"operation\": \"insert\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (353,NULL,NULL,'dataAccessRight','updateItem','✅数据权限-更新成员','sql','{}','{\"table\": \"student\", \"operation\": \"jhUpdate\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (354,NULL,NULL,'dataAccessRight','deleteItem','✅数据权限-删除信息','sql','{}','{\"table\": \"student\", \"operation\": \"jhDelete\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (355,NULL,NULL,'dataAccessRight','selectItemListByService','✅数据权限-查询列表','service','{}','{\"service\": \"student\", \"serviceFunction\": \"selectStudentList\"}',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_resource` (`id`,`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (356,NULL,'{\"after\": [], \"before\": [{\"service\": \"student\", \"serviceFunction\": \"appendStudentInfoToUserInfo\"}]}','dataAccessRight','selectItemListByDynamicData','✅数据权限-查询列表','sql','{}','{\"table\": \"student\", \"where\": {\"classId\": \"ctx.userInfo.studentInfo.classId\"}, \"operation\": \"select\"}',NULL,NULL,'insert',NULL,NULL,NULL);
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: _resource_request_log
# ------------------------------------------------------------
DROP TABLE IF EXISTS `_resource_request_log`;
CREATE TABLE `_resource_request_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`resourceId` varchar(255) DEFAULT NULL COMMENT 'resource id;',
`packageId` varchar(255) DEFAULT NULL COMMENT 'resource package id',
`userIp` varchar(255) DEFAULT NULL COMMENT '用户ip;',
`userAgent` varchar(255) DEFAULT NULL COMMENT '设备信息',
`deviceId` varchar(255) DEFAULT NULL COMMENT '设备id',
`userIpRegion` varchar(255) DEFAULT NULL COMMENT '用户Ip区域',
`executeSql` varchar(255) DEFAULT NULL COMMENT '执行的sql',
`requestBody` json DEFAULT NULL COMMENT '请求body',
`responseBody` json DEFAULT NULL COMMENT '响应body',
`responseStatus` varchar(255) DEFAULT NULL COMMENT '执行的结果; success, fail',
`operation` varchar(255) DEFAULT 'insert' COMMENT '操作; insert, update, jhInsert, jhUpdate, jhDelete jhRestore',
`operationByUserId` varchar(255) DEFAULT NULL COMMENT '操作者userId',
`operationByUser` varchar(255) DEFAULT NULL COMMENT '操作者用户名',
`operationAt` varchar(255) DEFAULT NULL COMMENT '操作时间; E.g: 2021-05-28T10:24:54+08:00 ',
PRIMARY KEY (`id`),
KEY `resourceId_index` (`resourceId`),
KEY `packageId_index` (`packageId`)
) ENGINE = InnoDB AUTO_INCREMENT = 3632 COMMENT = '文件表; 软删除未启用;';
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: _role
# ------------------------------------------------------------
DROP TABLE IF EXISTS `_role`;
CREATE TABLE `_role` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`roleId` varchar(255) DEFAULT NULL COMMENT 'roleId',
`roleName` varchar(255) DEFAULT NULL COMMENT 'role name',
`roleDesc` varchar(255) DEFAULT NULL COMMENT 'role desc',
`operation` varchar(255) DEFAULT 'insert' COMMENT '操作; insert, update, jhInsert, jhUpdate, jhDelete jhRestore',
`operationByUserId` varchar(255) DEFAULT NULL COMMENT '操作者userId',
`operationByUser` varchar(255) DEFAULT NULL COMMENT '操作者用户名',
`operationAt` varchar(255) DEFAULT NULL COMMENT '操作时间; E.g: 2021-05-28T10:24:54+08:00 ',
PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 8 COMMENT = '角色表; 软删除未启用;';
# ------------------------------------------------------------
# DATA DUMP FOR TABLE: _role
# ------------------------------------------------------------
INSERT INTO `_role` (`id`,`roleId`,`roleName`,`roleDesc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (3,'appAdmin','系统管理员','','insert',NULL,NULL,NULL);
INSERT INTO `_role` (`id`,`roleId`,`roleName`,`roleDesc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (6,'boss','掌门','','insert',NULL,NULL,NULL);
INSERT INTO `_role` (`id`,`roleId`,`roleName`,`roleDesc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (7,'disciple','门徒','','insert',NULL,NULL,NULL);
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: _ui
# ------------------------------------------------------------
DROP TABLE IF EXISTS `_ui`;
CREATE TABLE `_ui` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pageId` varchar(255) DEFAULT NULL COMMENT 'page id; E.g: index',
`uiActionType` varchar(255) DEFAULT NULL COMMENT 'ui 动作类型,如:fetchData, postData, changeUi',
`uiActionId` varchar(255) DEFAULT NULL COMMENT 'action id; E.g: selectXXXByXXX',
`desc` varchar(255) DEFAULT NULL COMMENT '描述',
`uiActionConfig` text COMMENT 'ui 动作数据',
`appDataSchema` text COMMENT 'ui 校验数据',
`operation` varchar(255) DEFAULT 'insert' COMMENT '操作; insert, update, jhInsert, jhUpdate, jhDelete jhRestore',
`operationByUserId` varchar(255) DEFAULT NULL COMMENT '操作者userId',
`operationByUser` varchar(255) DEFAULT NULL COMMENT '操作者用户名',
`operationAt` varchar(255) DEFAULT NULL COMMENT '操作时间; E.g: 2021-05-28T10:24:54+08:00 ',
PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 64 COMMENT = 'ui 施工方案';
# ------------------------------------------------------------
# DATA DUMP FOR TABLE: _ui
# ------------------------------------------------------------
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (1,'uiAction','ui','refreshTableData','✅获取表格数据','{ \"main\": [{\"function\": \"refreshTableData\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (3,'uiAction','ui','startInsertItem','✅打开创建数据抽屉','{ \"main\": [{\"function\": \"clearCreateForm\"}, {\"function\": \"openCreateDrawer\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (4,'uiAction','ui','createItem','✅创建数据','{ \"before\": [{\"function\": \"prepareValidate\"}, {\"function\": \"prepareCreateItem\"}, {\"function\": \"confirmCreateFormDialog\"}], \"main\": [ {\"function\": \"doCreateItem\"}], \"after\": [{\"function\": \"closeCreateDrawer\"}, {\"function\": \"refreshTableData\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (5,'uiAction','ui','startUpdateItem','✅打开更新数据抽屉','{ \"main\": [{\"function\": \"fillUpdateForm\"}, {\"function\": \"openUpdateDrawer\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (6,'uiAction','ui','updateItem','✅更新数据','{ \"before\": [{\"function\": \"prepareValidate\"}, {\"function\": \"confirmUpdateItemDialog\"}], \"main\": [{\"function\": \"doUpdateItem\"}, {\"function\": \"refreshTableData\"}], \"after\": [{\"function\": \"closeUpdateDrawer\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (7,'uiAction','ui','deleteItem','✅删除数据','{ \"before\": [{\"function\": \"confirmDeleteItemDialog\"}], \"main\": [ {\"function\": \"doDeleteItem\"}, {\"function\": \"refreshTableData\"}], \"after\": [] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (11,'uiActionComponent','ui','refreshTableData','✅获取表格数据','{ \"before\": [{\"vueComponent\": \"classSelectDialog\", \"function\": \"selectItem\", \"functionParamObj\": { \"item\": { \"value\": \"2021-01级-01班\" } }}], \"main\": [{\"function\": \"refreshTableData\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (13,'uiActionComponent','ui','startCreateItem','✅打开创建数据抽屉','{ \"main\": [{\"function\": \"clearItemData\"}, {\"function\": \"openCreateDialog\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (14,'uiActionComponent','ui','insertItem','✅创建数据','{ \"before\": [{\"function\": \"prepareValidate\"}, {\"vueComponent\": \"jhConfirmDialog\", \"function\": \"confirmDialog\", \"functionParamObj\": { \"title\": \"新增\", \"content\": \"确定新增吗?\" }}], \"main\": [{\"function\": \"prepareCreateItem\"}, {\"function\": \"doCreateItem\"}, {\"function\": \"refreshTableData\"}], \"after\": [{\"function\": \"closeDrawerShow\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (15,'uiActionComponent','ui','startUpdateItem','✅打开更新数据抽屉','{ \"main\": [{\"function\": \"prepareItemData\"}, {\"function\": \"openUpdateDialog\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (16,'uiActionComponent','ui','updateItem','✅更新数据','{ \"before\": [{\"function\": \"prepareValidate\"}, {\"vueComponent\": \"jhConfirmDialog\", \"function\": \"confirmDialog\", \"functionParamObj\": { \"title\": \"修改\", \"content\": \"确定修改吗?\" }}], \"main\": [{\"function\": \"doUpdateItem\"}, {\"function\": \"refreshTableData\"}], \"after\": [{\"function\": \"closeDrawerShow\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (17,'uiActionComponent','ui','deleteItem','✅删除数据','{ \"before\": [{\"vueComponent\": \"jhConfirmDialog\", \"function\": \"confirmDialog\", \"functionParamObj\": { \"title\": \"删除\", \"content\": \"确定删除吗?\" }}], \"main\": [{\"function\": \"prepareItemData\"}, {\"function\": \"doDeleteItem\"}, {\"function\": \"refreshTableData\"}], \"after\": [] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (30,'resourceHook','ui','refreshTableData','✅获取表格数据','{ \"main\": [{\"function\": \"refreshTableData\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (31,'resourceHook','ui','startCreateItem','✅打开创建数据抽屉','{ \"main\": [{\"function\": \"clearItemData\"}, {\"function\": \"openCreateDialog\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (32,'resourceHook','ui','createItem','✅创建数据','{ \"before\": [{\"function\": \"prepareValidate\"}, {\"function\": \"confirmCreateItemDialog\"}], \"main\": [{\"function\": \"doCreateItem\"}, {\"function\": \"refreshTableData\"}], \"after\": [{\"function\": \"closeDrawerShow\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (33,'resourceHook','ui','startUpdateItem','✅打开更新数据抽屉','{ \"main\": [{\"function\": \"prepareItemData\"}, {\"function\": \"openUpdateDialog\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (34,'resourceHook','ui','updateItem','✅更新数据','{ \"before\": [{\"function\": \"prepareValidate\"}, {\"function\": \"confirmUpdateItemDialog\"}], \"main\": [{\"function\": \"doUpdateItem\"}, {\"function\": \"refreshTableData\"}], \"after\": [{\"function\": \"closeDrawerShow\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (35,'resourceHook','ui','deleteItem','✅删除数据','{ \"before\": [{\"function\": \"confirmDeleteItemDialog\"}], \"main\": [{\"function\": \"prepareItemData\"}, {\"function\": \"doDeleteItem\"}, {\"function\": \"refreshTableData\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (40,'backendSearchDemo','ui','refreshTableData','✅获取表格数据','{ \"main\": [{\"function\": \"refreshTableData\"}]}',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (41,'backendSearchDemo','ui','startCreateItem','✅打开创建数据抽屉','{ \"main\": [{\"function\": \"clearItemData\"}, {\"function\": \"openCreateDialog\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (42,'backendSearchDemo','ui','createItem','✅创建数据','{ \"before\": [{\"function\": \"prepareValidate\"}, {\"function\": \"confirmCreateItemDialog\"}], \"main\": [{\"function\": \"doCreateItem\"}, {\"function\": \"refreshTableData\"}], \"after\": [{\"function\": \"closeDrawerShow\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (43,'backendSearchDemo','ui','startUpdateItem','✅打开更新数据抽屉','{ \"main\": [{\"function\": \"prepareItemData\"}, {\"function\": \"openUpdateDialog\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (44,'backendSearchDemo','ui','updateItem','✅更新数据','{ \"before\": [{\"function\": \"prepareValidate\"}, {\"function\": \"confirmUpdateItemDialog\"}], \"main\": [{\"function\": \"doUpdateItem\"}, {\"function\": \"refreshTableData\"}], \"after\": [{\"function\": \"closeDrawerShow\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (45,'backendSearchDemo','ui','deleteItem','✅删除数据','{ \"before\": [{\"function\": \"confirmDeleteItemDialog\"}], \"main\": [{\"function\": \"prepareItemData\"}, {\"function\": \"doDeleteItem\"}, {\"function\": \"refreshTableData\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (50,'dataAccessRight','ui','refreshTableData','✅获取表格数据','{ \"main\": [{\"function\": \"refreshTableData\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (51,'dataAccessRight','ui','startCreateItem','✅打开创建数据抽屉','{ \"main\": [{\"function\": \"clearItemData\"}, {\"function\": \"openCreateDialog\"}]}',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (52,'dataAccessRight','ui','createItem','✅创建数据','{ \"before\": [{\"function\": \"prepareValidate\"}, {\"function\": \"confirmCreateItemDialog\"}], \"main\": [{\"function\": \"doCreateItem\"}, {\"function\": \"refreshTableData\"}], \"after\": [{\"function\": \"closeDrawerShow\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (53,'dataAccessRight','ui','startUpdateItem','✅打开更新数据抽屉','{ \"main\": [{\"function\": \"prepareItemData\"}, {\"function\": \"openUpdateDialog\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (54,'dataAccessRight','ui','updateItem','✅更新数据','{ \"before\": [{\"function\": \"prepareValidate\"}, {\"function\": \"confirmUpdateItemDialog\"}], \"main\": [{\"function\": \"doUpdateItem\"}, {\"function\": \"refreshTableData\"}], \"after\": [{\"function\": \"closeDrawerShow\"}] }',NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_ui` (`id`,`pageId`,`uiActionType`,`uiActionId`,`desc`,`uiActionConfig`,`appDataSchema`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (55,'dataAccessRight','ui','deleteItem','✅删除数据','{ \"before\": [{\"function\": \"confirmDeleteItemDialog\"}], \"main\": [{\"function\": \"prepareItemData\"}, {\"function\": \"doDeleteItem\"}, {\"function\": \"refreshTableData\"}] }',NULL,'insert',NULL,NULL,NULL);
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: _user
# ------------------------------------------------------------
DROP TABLE IF EXISTS `_user`;
CREATE TABLE `_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idSequence` varchar(255) DEFAULT NULL COMMENT '自增id; 用于生成userId',
`userId` varchar(255) DEFAULT NULL COMMENT '主键id',
`username` varchar(255) DEFAULT NULL COMMENT '用户名(登陆)',
`clearTextPassword` varchar(255) DEFAULT NULL COMMENT '明文密码',
`password` varchar(255) DEFAULT NULL COMMENT '密码',
`md5Salt` varchar(255) DEFAULT NULL COMMENT 'md5Salt',
`userStatus` varchar(255) DEFAULT 'active' COMMENT '用户账号状态:活跃或关闭',
`userType` varchar(255) DEFAULT NULL COMMENT '用户类型; staff, student.',
`config` mediumtext COMMENT '配置信息',
`operation` varchar(255) DEFAULT 'insert' COMMENT '操作; insert, update, jhInsert, jhUpdate, jhDelete jhRestore',
`operationByUserId` varchar(255) DEFAULT NULL COMMENT '操作者userId',
`operationByUser` varchar(255) DEFAULT NULL COMMENT '操作者用户名',
`operationAt` varchar(255) DEFAULT NULL COMMENT '操作时间; E.g: 2021-05-28T10:24:54+08:00 ',
PRIMARY KEY (`id`),
UNIQUE KEY `username_index` (`username`),
UNIQUE KEY `userId_index` (`userId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 50 COMMENT = '用户表';
# ------------------------------------------------------------
# DATA DUMP FOR TABLE: _user
# ------------------------------------------------------------
INSERT INTO `_user` (`id`,`idSequence`,`userId`,`username`,`clearTextPassword`,`password`,`md5Salt`,`userStatus`,`userType`,`config`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (42,NULL,'admin','系统管理员','123456','38d61d315e62546fe7f1013e31d42f57','Xs4JSZnhiwsR','active',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_user` (`id`,`idSequence`,`userId`,`username`,`clearTextPassword`,`password`,`md5Salt`,`userStatus`,`userType`,`config`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (43,NULL,'W00001','张三丰','123456','38d61d315e62546fe7f1013e31d42f57','Xs4JSZnhiwsR','active',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_user` (`id`,`idSequence`,`userId`,`username`,`clearTextPassword`,`password`,`md5Salt`,`userStatus`,`userType`,`config`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (44,NULL,'W00002','张无忌','123456','38d61d315e62546fe7f1013e31d42f57','Xs4JSZnhiwsR','active',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_user` (`id`,`idSequence`,`userId`,`username`,`clearTextPassword`,`password`,`md5Salt`,`userStatus`,`userType`,`config`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (45,NULL,'G00001','洪七公','123456','38d61d315e62546fe7f1013e31d42f57','Xs4JSZnhiwsR','active',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_user` (`id`,`idSequence`,`userId`,`username`,`clearTextPassword`,`password`,`md5Salt`,`userStatus`,`userType`,`config`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (46,NULL,'G00002','郭靖','123456','38d61d315e62546fe7f1013e31d42f57','Xs4JSZnhiwsR','active',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_user` (`id`,`idSequence`,`userId`,`username`,`clearTextPassword`,`password`,`md5Salt`,`userStatus`,`userType`,`config`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (47,NULL,'H00001','岳不群','123456','38d61d315e62546fe7f1013e31d42f57','Xs4JSZnhiwsR','active',NULL,NULL,'insert',NULL,NULL,NULL);
INSERT INTO `_user` (`id`,`idSequence`,`userId`,`username`,`clearTextPassword`,`password`,`md5Salt`,`userStatus`,`userType`,`config`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (48,NULL,'H00002','令狐冲','123456','38d61d315e62546fe7f1013e31d42f57','Xs4JSZnhiwsR','active',NULL,NULL,'insert',NULL,NULL,NULL);
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: _user_group_role
# ------------------------------------------------------------
DROP TABLE IF EXISTS `_user_group_role`;
CREATE TABLE `_user_group_role` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userId` varchar(255) NOT NULL COMMENT '用户id',
`groupId` varchar(255) NOT NULL COMMENT '群组Id',
`roleId` varchar(255) DEFAULT NULL COMMENT '角色Id',
`operation` varchar(255) DEFAULT 'insert' COMMENT '操作; insert, update, jhInsert, jhUpdate, jhDelete jhRestore',
`operationByUserId` varchar(255) DEFAULT NULL COMMENT '操作者userId',
`operationByUser` varchar(255) DEFAULT NULL COMMENT '操作者用户名',
`operationAt` varchar(255) DEFAULT NULL COMMENT '操作时间; E.g: 2021-05-28T10:24:54+08:00 ',
PRIMARY KEY (`id`),
KEY `groupId_index` (`groupId`),
KEY `userId_index` (`userId`)
) ENGINE = InnoDB AUTO_INCREMENT = 587 COMMENT = '用户群组角色关联表; 软删除未启用;';
# ------------------------------------------------------------
# DATA DUMP FOR TABLE: _user_group_role
# ------------------------------------------------------------
INSERT INTO `_user_group_role` (`id`,`userId`,`groupId`,`roleId`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (568,'admin','adminGroup','appAdmin','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role` (`id`,`userId`,`groupId`,`roleId`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (569,'W00001','wudang','boss','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role` (`id`,`userId`,`groupId`,`roleId`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (570,'W00002','wudang','disciple','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role` (`id`,`userId`,`groupId`,`roleId`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (573,'G00001','gaibang','boss','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role` (`id`,`userId`,`groupId`,`roleId`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (574,'G00002','gaibang','disciple','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role` (`id`,`userId`,`groupId`,`roleId`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (577,'H00001','huashan','boss','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role` (`id`,`userId`,`groupId`,`roleId`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (578,'H00002','huashan','disciple','insert',NULL,NULL,NULL);
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: _user_group_role_page
# ------------------------------------------------------------
DROP TABLE IF EXISTS `_user_group_role_page`;
CREATE TABLE `_user_group_role_page` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user` varchar(255) DEFAULT NULL COMMENT 'userId 或者 通配符; 通配符: *',
`group` varchar(255) DEFAULT NULL COMMENT 'groupId 或者 通配符; 通配符: *',
`role` varchar(255) DEFAULT NULL COMMENT 'roleId 或者 通配符; 通配符: *',
`page` varchar(255) DEFAULT NULL COMMENT 'pageId id',
`allowOrDeny` varchar(255) DEFAULT NULL COMMENT '用户群组角色 匹配后 执行动作; allow、deny',
`desc` varchar(255) DEFAULT NULL COMMENT '映射描述',
`operation` varchar(255) DEFAULT 'insert' COMMENT '操作; insert, update, jhInsert, jhUpdate, jhDelete jhRestore',
`operationByUserId` varchar(255) DEFAULT NULL COMMENT '操作者userId',
`operationByUser` varchar(255) DEFAULT NULL COMMENT '操作者用户名',
`operationAt` varchar(255) DEFAULT NULL COMMENT '操作时间; E.g: 2021-05-28T10:24:54+08:00 ',
PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 31 COMMENT = '用户群组角色 - 页面 映射表; 软删除未启用;';
# ------------------------------------------------------------
# DATA DUMP FOR TABLE: _user_group_role_page
# ------------------------------------------------------------
INSERT INTO `_user_group_role_page` (`id`,`user`,`group`,`role`,`page`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (17,'*','public','*','login','allow','登陆页; 开放给所有用户;','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_page` (`id`,`user`,`group`,`role`,`page`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (18,'*','login','*','manual','allow','操作手册页; 开放给登陆用户;','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_page` (`id`,`user`,`group`,`role`,`page`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (19,'*','login','*','help','allow','帮助页; 开放给登陆用户;','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_page` (`id`,`user`,`group`,`role`,`page`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (21,'*','adminGroup','appAdmin','*','allow','所有页面; 开放给应用管理者;','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_page` (`id`,`user`,`group`,`role`,`page`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (27,'*','wudang','boss,disciple','protocolDemo','allow','studentManagement01; 开放给武当派派掌门&门徒;','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_page` (`id`,`user`,`group`,`role`,`page`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (28,'*','gaibang','boss,disciple','frontendDemo01,frontendDemo02','allow','studentManagement02&studentManagement03; 开放给丐帮掌门&门徒;','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_page` (`id`,`user`,`group`,`role`,`page`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (29,'*','huashan','boss,disciple','backendSearchDemo','allow','studentManagement04; 开放给华山派掌门&门徒;','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_page` (`id`,`user`,`group`,`role`,`page`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (30,'*','*','boss,disciple','dataAccessRight','allow','数据权限demo','insert',NULL,NULL,NULL);
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: _user_group_role_resource
# ------------------------------------------------------------
DROP TABLE IF EXISTS `_user_group_role_resource`;
CREATE TABLE `_user_group_role_resource` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user` varchar(255) DEFAULT NULL COMMENT 'userId 或者 通配符; 通配符: *',
`group` varchar(255) DEFAULT NULL COMMENT 'groupId 或者 通配符; 通配符: *',
`role` varchar(255) DEFAULT NULL COMMENT 'roleId 或者 通配符; 通配符: *',
`resource` varchar(255) DEFAULT NULL COMMENT 'resourceId 或者 通配符; 通配符: *, !resourceId',
`allowOrDeny` varchar(255) DEFAULT NULL COMMENT '用户群组角色 匹配后 执行动作; allow、deny',
`desc` varchar(255) DEFAULT NULL COMMENT '映射描述',
`operation` varchar(255) DEFAULT 'insert' COMMENT '操作; insert, update, jhInsert, jhUpdate, jhDelete jhRestore',
`operationByUserId` varchar(255) DEFAULT NULL COMMENT '操作者userId',
`operationByUser` varchar(255) DEFAULT NULL COMMENT '操作者用户名',
`operationAt` varchar(255) DEFAULT NULL COMMENT '操作时间; E.g: 2021-05-28T10:24:54+08:00 ',
PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 135 COMMENT = '用户群组角色 - 请求资源 映射表; 软删除未启用;';
# ------------------------------------------------------------
# DATA DUMP FOR TABLE: _user_group_role_resource
# ------------------------------------------------------------
INSERT INTO `_user_group_role_resource` (`id`,`user`,`group`,`role`,`resource`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (1,'*','public','*','login.passwordLogin','allow','登陆resource, 开放给所有用户','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_resource` (`id`,`user`,`group`,`role`,`resource`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (11,'*','public','*','allPage.getConstantList','allow','查询常量resource, 开放给所有登陆成功的用户','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_resource` (`id`,`user`,`group`,`role`,`resource`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (31,'*','login','*','allPage.logout','allow','登出resource, 开放给所有登陆成功的用户','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_resource` (`id`,`user`,`group`,`role`,`resource`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (32,'*','login','*','allPage.refreshToken','allow','刷新authToken resource, 开放给所有登陆成功的用户','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_resource` (`id`,`user`,`group`,`role`,`resource`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (33,'*','login','*','allPage.userInfo','allow','用户个人信息resource, 开放给所有登陆成功的用户','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_resource` (`id`,`user`,`group`,`role`,`resource`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (34,'*','login','*','allPage.uploadByBase64','allow','上传文件resource, 开放给所有登陆成功的用户','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_resource` (`id`,`user`,`group`,`role`,`resource`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (35,'*','login','*','allPage.uploadByStream','allow','上传文件resource, 开放给所有登陆成功的用户','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_resource` (`id`,`user`,`group`,`role`,`resource`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (51,'*','adminGroup','appAdmin','*','allow','应用管理者, 赋予所有resource权限','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_resource` (`id`,`user`,`group`,`role`,`resource`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (117,'*','wudang','boss','protocolDemo.*','allow','page01 内的所有操作; 开放给武当派掌门;','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_resource` (`id`,`user`,`group`,`role`,`resource`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (118,'*','wudang','disciple','protocolDemo.selectItemList','allow','page01 内的查询列表操作; 开放给武当派门徒;','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_resource` (`id`,`user`,`group`,`role`,`resource`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (125,'*','gaibang','boss','frontendDemo01.*,frontendDemo02.*','allow','page02&page03 内的所有操作; 开放给丐帮掌门&门徒;','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_resource` (`id`,`user`,`group`,`role`,`resource`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (126,'*','gaibang','disciple','frontendDemo01.selectItemList,frontendDemo02.selectItemList','allow','page02&page03 内的查询列表操作; 开放给丐帮掌门&门徒;','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_resource` (`id`,`user`,`group`,`role`,`resource`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (131,'*','huashan','boss','backendSearchDemo.*','allow','page04 内的所有操作; 开放给华山派掌门&门徒;','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_resource` (`id`,`user`,`group`,`role`,`resource`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (132,'*','huashan','disciple','backendSearchDemo.selectItemList','allow','page04 内的查询列表操作; 开放给华山派掌门&门徒;','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_resource` (`id`,`user`,`group`,`role`,`resource`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (133,'*','*','boss','dataAccessRight.*','allow','page05 内的所有操作; 开放给所有掌门','insert',NULL,NULL,NULL);
INSERT INTO `_user_group_role_resource` (`id`,`user`,`group`,`role`,`resource`,`allowOrDeny`,`desc`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (134,'*','*','disciple','dataAccessRight.selectItemList','allow','page05 内的查询列表操作; 开放给所有门徒;','insert',NULL,NULL,NULL);
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: _user_session
# ------------------------------------------------------------
DROP TABLE IF EXISTS `_user_session`;
CREATE TABLE `_user_session` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userId` varchar(255) DEFAULT NULL COMMENT '用户id',
`userIp` varchar(255) DEFAULT NULL COMMENT '用户ip',
`userIpRegion` varchar(255) DEFAULT NULL COMMENT '用户Ip区域',
`userAgent` text COMMENT '请求的 agent',
`deviceId` varchar(255) DEFAULT NULL COMMENT '设备id',
`deviceType` varchar(255) DEFAULT 'web' COMMENT '设备类型; flutter, web, bot_databot, bot_chatbot, bot_xiaochengxu',
`socketStatus` varchar(255) DEFAULT 'offline' COMMENT 'socket状态',
`authToken` varchar(255) DEFAULT NULL COMMENT 'auth token',
`operation` varchar(255) DEFAULT 'insert' COMMENT '操作; insert, update, jhInsert, jhUpdate, jhDelete jhRestore',
`operationByUserId` varchar(255) DEFAULT NULL COMMENT '操作者userId',
`operationByUser` varchar(255) DEFAULT NULL COMMENT '操作者用户名',
`operationAt` varchar(255) DEFAULT NULL COMMENT '操作时间; E.g: 2021-05-28T10:24:54+08:00 ',
PRIMARY KEY (`id`),
KEY `userId_index` (`userId`),
KEY `userId_deviceId_index` (`userId`, `deviceId`) USING BTREE,
KEY `authToken_index` (`authToken`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 22 COMMENT = '用户session表; deviceId 维度;软删除未启用;';
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: access_control_student
# ------------------------------------------------------------
DROP TABLE IF EXISTS `access_control_student`;
CREATE TABLE `access_control_student` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userId` varchar(255) DEFAULT NULL COMMENT '主键id',
`username` varchar(255) DEFAULT NULL COMMENT '用户名(登陆)',
`resourceData` varchar(255) DEFAULT NULL COMMENT '明文密码',
`operation` varchar(255) DEFAULT 'insert' COMMENT '操作; insert, update, jhInsert, jhUpdate, jhDelete jhRestore',
`operationByUserId` varchar(255) DEFAULT NULL COMMENT '操作者userId',
`operationByUser` varchar(255) DEFAULT NULL COMMENT '操作者用户名',
`operationAt` varchar(255) DEFAULT NULL COMMENT '操作时间; E.g: 2021-05-28T10:24:54+08:00 ',
PRIMARY KEY (`id`),
UNIQUE KEY `username_index` (`username`),
UNIQUE KEY `userId_index` (`userId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 52 COMMENT = '学生表的 accessControl 表';
# ------------------------------------------------------------
# DATA DUMP FOR TABLE: access_control_student
# ------------------------------------------------------------
INSERT INTO `access_control_student` (`id`,`userId`,`username`,`resourceData`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (50,'G00001','洪七公','{ \"where\":{\"level\": \"02\"} }','insert',NULL,NULL,NULL);
INSERT INTO `access_control_student` (`id`,`userId`,`username`,`resourceData`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (51,'H00001','岳不群','{ \"where\":{\"level\": \"02\"} }','insert',NULL,NULL,NULL);
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: student
# ------------------------------------------------------------
DROP TABLE IF EXISTS `student`;
CREATE TABLE `student` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`studentId` varchar(255) DEFAULT NULL COMMENT '学生ID',
`name` varchar(255) DEFAULT NULL COMMENT '学生名字',
`gender` varchar(255) DEFAULT NULL COMMENT '性别',
`dateOfBirth` varchar(255) DEFAULT NULL COMMENT '出生日期',
`classId` varchar(255) DEFAULT NULL COMMENT '班级ID',
`level` varchar(255) DEFAULT NULL COMMENT '年级',
`bodyHeight` varchar(255) DEFAULT NULL COMMENT '身高',
`studentStatus` varchar(255) DEFAULT NULL COMMENT '学生状态',
`remarks` mediumtext COMMENT '备注',
`operation` varchar(255) DEFAULT 'insert' COMMENT '操作; insert, update, jhInsert, jhUpdate, jhDelete jhRestore',
`operationByUserId` varchar(255) DEFAULT NULL COMMENT '操作者userId',
`operationByUser` varchar(255) DEFAULT NULL COMMENT '操作者用户名',
`operationAt` varchar(255) DEFAULT NULL COMMENT '操作时间; E.g: 2021-05-28T10:24:54+08:00 ',
PRIMARY KEY (`id`) USING BTREE,
KEY `studentId` (`studentId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 181;
# ------------------------------------------------------------
# DATA DUMP FOR TABLE: student
# ------------------------------------------------------------
INSERT INTO `student` (`id`,`studentId`,`name`,`gender`,`dateOfBirth`,`classId`,`level`,`bodyHeight`,`studentStatus`,`remarks`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (161,'G00003','小虾米','male','2022-01-25','2021-01级-02班','02','180','正常','小虾米','jhUpdate','admin','系统管理员','2022-05-01T15:29:52+08:00');
INSERT INTO `student` (`id`,`studentId`,`name`,`gender`,`dateOfBirth`,`classId`,`level`,`bodyHeight`,`studentStatus`,`remarks`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (168,'100067','1111','male','2022-05-02','2021-01级-01班','01',NULL,NULL,NULL,'jhUpdate','admin','系统管理员','2022-05-01T23:38:23+08:00');
INSERT INTO `student` (`id`,`studentId`,`name`,`gender`,`dateOfBirth`,`classId`,`level`,`bodyHeight`,`studentStatus`,`remarks`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (173,'121432','21434',NULL,NULL,'2021-01级-01班',NULL,NULL,NULL,NULL,'jhInsert','admin','系统管理员','2022-05-01T23:37:58+08:00');
INSERT INTO `student` (`id`,`studentId`,`name`,`gender`,`dateOfBirth`,`classId`,`level`,`bodyHeight`,`studentStatus`,`remarks`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (174,'admin','系统管理员','male','2022-05-02','2021-01级-01班','01',NULL,NULL,NULL,'jhUpdate','admin','系统管理员','2022-05-03T21:17:52+08:00');
INSERT INTO `student` (`id`,`studentId`,`name`,`gender`,`dateOfBirth`,`classId`,`level`,`bodyHeight`,`studentStatus`,`remarks`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) VALUES (175,'1000221','221','male','2022-05-08','2021-01级-02班','01',NULL,NULL,NULL,'jhUpdate','admin','系统管理员','2022-05-03T20:50:51+08:00');
# ------------------------------------------------------------
# SCHEMA DUMP FOR TABLE: _view01_user
# ------------------------------------------------------------
CREATE OR REPLACE VIEW `_view01_user` AS
select
`_user`.`id` AS `id`,
`_user`.`idSequence` AS `idSequence`,
`_user`.`userId` AS `userId`,
`_user`.`username` AS `username`,
`_user`.`clearTextPassword` AS `clearTextPassword`,
`_user`.`password` AS `password`,
`_user`.`md5Salt` AS `md5Salt`,
`_user`.`userStatus` AS `userStatus`,
`_user`.`userType` AS `userType`,
`_user`.`config` AS `config`,
`_user`.`operation` AS `operation`,
`_user`.`operationByUserId` AS `operationByUserId`,
`_user`.`operationByUser` AS `operationByUser`,
`_user`.`operationAt` AS `operationAt`
from
`_user`;