Commit 05842014 authored by 萌萌哒SAKURA酱's avatar 萌萌哒SAKURA酱

Merge branch 'leng_dev' of https://gitee.ltd/pigx/pigx-ui into sakura_dev

parents e8933196 ebdf00cd
# http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
<template> <template>
<div id="app"> <div id="app">
<router-view /> <router-view/>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'app', name: 'app',
data () { data() {
return {} return {}
}, },
watch: {}, watch: {},
created () { }, created() {
methods: {}, },
computed: {} methods: {},
} computed: {}
}
</script> </script>
<style lang="scss"> <style lang="scss">
#app { #app {
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
} }
</style> </style>
\ No newline at end of file
...@@ -33,10 +33,10 @@ export function delObj(id) { ...@@ -33,10 +33,10 @@ export function delObj(id) {
} }
export function deploy(id) { export function deploy(id) {
return request({ return request({
url: '/act/model/deploy/' + id, url: '/act/model/deploy/' + id,
method: 'post' method: 'post'
}) })
} }
......
...@@ -41,10 +41,10 @@ export function getObj(id) { ...@@ -41,10 +41,10 @@ export function getObj(id) {
} }
export function submit(id) { export function submit(id) {
return request({ return request({
url: '/act/leave-bill/submit/' + id, url: '/act/leave-bill/submit/' + id,
method: 'get' method: 'get'
}) })
} }
export function delObj(id) { export function delObj(id) {
......
...@@ -32,9 +32,9 @@ export function delObj(id) { ...@@ -32,9 +32,9 @@ export function delObj(id) {
}) })
} }
export function status(id,type) { export function status(id, type) {
return request({ return request({
url: '/act/process/status/' + id + "/" + type, url: '/act/process/status/' + id + "/" + type,
method: 'put' method: 'put'
}) })
} }
...@@ -26,23 +26,23 @@ export function fetchList(query) { ...@@ -26,23 +26,23 @@ export function fetchList(query) {
} }
export function fetchDetail(id) { export function fetchDetail(id) {
return request({ return request({
url: '/act/task/'+id, url: '/act/task/' + id,
method: 'get' method: 'get'
}) })
} }
export function fetchComment(id) { export function fetchComment(id) {
return request({ return request({
url: '/act/task/comment/'+id, url: '/act/task/comment/' + id,
method: 'get' method: 'get'
}) })
} }
export function doTask(obj) { export function doTask(obj) {
return request({ return request({
url: '/act/task', url: '/act/task',
method: 'post', method: 'post',
data: obj data: obj
}) })
} }
...@@ -18,11 +18,11 @@ ...@@ -18,11 +18,11 @@
import request from '@/router/axios' import request from '@/router/axios'
export function fetchDeptTree(query) { export function fetchDeptTree(query) {
return request({ return request({
url: '/admin/dept/user-tree', url: '/admin/dept/user-tree',
method: 'get', method: 'get',
params: query params: query
}) })
} }
export function fetchTree(query) { export function fetchTree(query) {
......
...@@ -16,12 +16,14 @@ ...@@ -16,12 +16,14 @@
*/ */
import request from '@/router/axios' import request from '@/router/axios'
export function GetMenu() { export function GetMenu() {
return request({ return request({
url: '/admin/menu', url: '/admin/menu',
method: 'get' method: 'get'
}) })
} }
export function fetchTree(query) { export function fetchTree(query) {
return request({ return request({
url: '/admin/menu/tree', url: '/admin/menu/tree',
......
...@@ -24,10 +24,11 @@ export function fetchList(query) { ...@@ -24,10 +24,11 @@ export function fetchList(query) {
params: query params: query
}) })
} }
export function putObj(obj) { export function putObj(obj) {
return request({ return request({
url: '/admin/route', url: '/admin/route',
method: 'put', method: 'put',
data: obj data: obj
}) })
} }
...@@ -18,46 +18,46 @@ ...@@ -18,46 +18,46 @@
import request from '@/router/axios' import request from '@/router/axios'
export function fetchList(query) { export function fetchList(query) {
return request({ return request({
url: '/admin/user/page', url: '/admin/user/page',
method: 'get', method: 'get',
params: query params: query
}) })
} }
export function addObj(obj) { export function addObj(obj) {
return request({ return request({
url: '/admin/user', url: '/admin/user',
method: 'post', method: 'post',
data: obj data: obj
}) })
} }
export function getObj(id) { export function getObj(id) {
return request({ return request({
url: '/admin/user/' + id, url: '/admin/user/' + id,
method: 'get' method: 'get'
}) })
} }
export function delObj(id) { export function delObj(id) {
return request({ return request({
url: '/admin/user/' + id, url: '/admin/user/' + id,
method: 'delete' method: 'delete'
}) })
} }
export function putObj(obj) { export function putObj(obj) {
return request({ return request({
url: '/admin/user', url: '/admin/user',
method: 'put', method: 'put',
data: obj data: obj
}) })
} }
export function getDetails(obj) { export function getDetails(obj) {
return request({ return request({
url: '/admin/user/details/' + obj, url: '/admin/user/details/' + obj,
method: 'get' method: 'get'
}) })
} }
...@@ -26,16 +26,22 @@ export function fetchList(query) { ...@@ -26,16 +26,22 @@ export function fetchList(query) {
} }
export function handleDown(table) { export function handleDown(table) {
request({ return request({
url: '/gen/generator/code', url: '/gen/generator/code',
method: 'post', method: 'post',
data: table, data: table,
responseType: 'arraybuffer' responseType: 'arraybuffer'
}).then((response) => { // 处理返回的文件流 }).then((response) => { // 处理返回的文件流
let blob = new Blob([response.data], { type: 'application/zip' } ) let blob = new Blob([response.data], {type: 'application/zip'})
let link = document.createElement('a') let filename = table.tableName + '.zip'
link.href = window.URL.createObjectURL(blob) let link = document.createElement('a');
link.download = table.tableName + '.zip' link.href = URL.createObjectURL(blob);
link.click() link.download = filename;
document.body.appendChild(link);
link.click();
window.setTimeout(function () {
URL.revokeObjectURL(blob);
document.body.removeChild(link);
}, 0);
}) })
} }
...@@ -15,56 +15,57 @@ ...@@ -15,56 +15,57 @@
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
import request from '@/router/axios' import request from '@/router/axios'
export const loginByUsername = (username, password, code, randomStr) => { export const loginByUsername = (username, password, code, randomStr) => {
var grant_type = 'password' var grant_type = 'password'
var scope = 'server' var scope = 'server'
return request({ return request({
url: '/auth/oauth/token', url: '/auth/oauth/token',
headers: { headers: {
'TENANT_ID': '1', 'TENANT_ID': '1',
'Authorization': 'Basic cGlnOnBpZw==' 'Authorization': 'Basic cGlnOnBpZw=='
}, },
method: 'post', method: 'post',
params: { username, password, randomStr, code, grant_type, scope } params: {username, password, randomStr, code, grant_type, scope}
}) })
} }
export const loginByMobile = (mobile, code) => { export const loginByMobile = (mobile, code) => {
var grant_type = 'mobile' var grant_type = 'mobile'
return request({ return request({
url: '/auth/mobile/token/sms', url: '/auth/mobile/token/sms',
headers: { headers: {
'TENANT_ID': '1', 'TENANT_ID': '1',
'Authorization': 'Basic cGlnOnBpZw==' 'Authorization': 'Basic cGlnOnBpZw=='
}, },
method: 'post', method: 'post',
params: { mobile: 'SMS@' + mobile,code: code, grant_type } params: {mobile: 'SMS@' + mobile, code: code, grant_type}
}) })
} }
export const loginBySocial = (state, code) => { export const loginBySocial = (state, code) => {
var grant_type = 'mobile' var grant_type = 'mobile'
return request({ return request({
url: '/auth/mobile/token/social', url: '/auth/mobile/token/social',
headers: { headers: {
'TENANT_ID': '1', 'TENANT_ID': '1',
'Authorization': 'Basic cGlnOnBpZw==' 'Authorization': 'Basic cGlnOnBpZw=='
}, },
method: 'post', method: 'post',
params: { mobile: state + '@' + code, grant_type } params: {mobile: state + '@' + code, grant_type}
}) })
} }
export const getUserInfo = () => { export const getUserInfo = () => {
return request({ return request({
url: '/admin/user/info', url: '/admin/user/info',
method: 'get' method: 'get'
}) })
} }
export const logout = () => { export const logout = () => {
return request({ return request({
url: '/auth/token/logout', url: '/auth/token/logout',
method: 'delete' method: 'delete'
}) })
} }
...@@ -15,10 +15,10 @@ if (env.NODE_ENV == 'development') { ...@@ -15,10 +15,10 @@ if (env.NODE_ENV == 'development') {
} }
export { export {
baseUrl, baseUrl,
actUrl, actUrl,
iconfontUrl, iconfontUrl,
iconfontVersion, iconfontVersion,
codeUrl, codeUrl,
env env
} }
...@@ -15,59 +15,66 @@ ...@@ -15,59 +15,66 @@
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
export const tableOption = { export const tableOption = {
border: true, border: true,
index: true, index: true,
indexLabel: '序号', indexLabel: '序号',
stripe: true, stripe: true,
menuAlign: 'center', menuAlign: 'center',
menuWidth: 150, menuWidth: 150,
menuBtn: true, menuBtn: true,
align: 'center', align: 'center',
editBtn: false, editBtn: false,
delBtn: false, delBtn: false,
menuType:'menu', menuType: 'menu',
searchShow: false, searchShow: false,
labelWidth: 120, labelWidth: 120,
column: [{ column: [{
fixed: true, fixed: true,
label: '模型ID', label: '模型ID',
prop: 'id', prop: 'id',
editDisabled: true, editDisabled: true,
addVisdiplay: false addVisdiplay: false
}, {
fixed: true,
label: '模型标识',
prop: 'key',
editDisabled: true
}, {
label: '流程分类',
prop: 'category',
search: true
}, {
label: '模型名称',
prop: 'name'
},
{
label: '描述',
prop: 'desc',
hide: true,
editDisabled: false,
addVisdiplay: true
}, { }, {
fixed: true, label: '版本号',
label: '模型标识', prop: 'version',
prop: 'key', editDisabled: true,
editDisabled: true addVisdiplay: false
}, { }, {
label: '流程分类', width: 150,
prop: 'category', label: '创建时间',
search: true prop: 'createTime',
type: 'datetime',
format: 'yyyy-MM-dd HH:mm',
valueFormat: 'timestamp',
editDisabled: true,
addVisdiplay: false
}, { }, {
label: '模型名称', width: 150,
prop: 'name' label: '最后更新时间',
}, { prop: 'lastUpdateTime',
label: '版本号', type: 'datetime',
prop: 'version', format: 'yyyy-MM-dd HH:mm',
editDisabled: true, valueFormat: 'timestamp',
addVisdiplay: false editDisabled: true,
}, { addVisdiplay: false
width: 150,
label: '创建时间',
prop: 'createTime',
type: 'datetime',
format: 'yyyy-MM-dd HH:mm',
valueFormat: 'timestamp',
editDisabled: true,
addVisdiplay: false
}, {
width: 150,
label: '最后更新时间',
prop: 'lastUpdateTime',
type: 'datetime',
format: 'yyyy-MM-dd HH:mm',
valueFormat: 'timestamp',
editDisabled: true,
addVisdiplay: false
}] }]
} }
...@@ -25,60 +25,60 @@ export const tableOption = { ...@@ -25,60 +25,60 @@ export const tableOption = {
'editBtn': false, 'editBtn': false,
'delBtn': false, 'delBtn': false,
'addBtn': false, 'addBtn': false,
menuType:'menu', menuType: 'menu',
'dicUrl': '/admin/dict/type/leave_status', 'dicUrl': '/admin/dict/type/leave_status',
'column': [ 'column': [
{ {
label: 'ID', label: 'ID',
prop: 'leaveId', prop: 'leaveId',
editDisabled: true, editDisabled: true,
addVisdiplay: false addVisdiplay: false
}, },
{ {
label: '申请人', label: '申请人',
prop: 'username', prop: 'username',
editDisabled: true, editDisabled: true,
addVisdiplay: false addVisdiplay: false
}, },
{ {
label: '天数', label: '天数',
prop: 'days', prop: 'days',
type: 'number' type: 'number'
}, },
{ {
label: '请假时间', label: '请假时间',
prop: 'leaveTime', prop: 'leaveTime',
type: 'datetime', type: 'datetime',
overHidden:true, overHidden: true,
format: 'yyyy-MM-dd HH:mm', format: 'yyyy-MM-dd HH:mm',
valueFormat: "yyyy-MM-dd hh:mm:ss" valueFormat: "yyyy-MM-dd hh:mm:ss"
}, },
{ {
label: '提交时间', label: '提交时间',
prop: 'createTime', prop: 'createTime',
type: 'datetime', type: 'datetime',
overHidden:true, overHidden: true,
format: 'yyyy-MM-dd HH:mm', format: 'yyyy-MM-dd HH:mm',
editDisabled: true, editDisabled: true,
addVisdiplay: false, addVisdiplay: false,
hide: true hide: true
}, },
{ {
label: '状态', label: '状态',
prop: 'state', prop: 'state',
type: 'select', type: 'select',
dicData: 'leave_status', dicData: 'leave_status',
search: true, search: true,
addVisdiplay: false addVisdiplay: false
}, },
{ {
label: '备注', label: '备注',
prop: 'content', prop: 'content',
type:'textarea', type: 'textarea',
overHidden:true, overHidden: true,
minRows:2, minRows: 2,
row:true, row: true,
span:24 span: 24
} }
] ]
} }
...@@ -15,47 +15,47 @@ ...@@ -15,47 +15,47 @@
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
export const tableOption = { export const tableOption = {
border: true, border: true,
index: true, index: true,
indexLabel: '序号', indexLabel: '序号',
stripe: true, stripe: true,
menuAlign: 'center', menuAlign: 'center',
menuWidth: 150, menuWidth: 150,
menuBtn: true, menuBtn: true,
align: 'center', align: 'center',
addBtn: false, addBtn: false,
editBtn: false, editBtn: false,
delBtn: false, delBtn: false,
menuType:'menu', menuType: 'menu',
searchShow: false, searchShow: false,
column: [{ column: [{
fixed: true, fixed: true,
label: '流程ID', label: '流程ID',
prop: 'processonDefinitionId' prop: 'processonDefinitionId'
}, { }, {
fixed: true, fixed: true,
label: '模型标识', label: '模型标识',
prop: 'key', prop: 'key',
editDisabled: true editDisabled: true
}, { }, {
label: '流程分类', label: '流程分类',
prop: 'category', prop: 'category',
search: true search: true
}, { }, {
label: '模型名称', label: '模型名称',
prop: 'name' prop: 'name'
}, { }, {
label: '版本号', label: '版本号',
prop: 'revision', prop: 'revision',
editDisabled: true, editDisabled: true,
addVisdiplay: false addVisdiplay: false
}, { }, {
label: '部署时间', label: '部署时间',
prop: 'deploymentTime', prop: 'deploymentTime',
type: 'datetime', type: 'datetime',
format: 'yyyy-MM-dd HH:mm', format: 'yyyy-MM-dd HH:mm',
valueFormat: 'timestamp', valueFormat: 'timestamp',
editDisabled: true, editDisabled: true,
addVisdiplay: false addVisdiplay: false
}] }]
} }
...@@ -15,128 +15,128 @@ ...@@ -15,128 +15,128 @@
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
export const tableOption = { export const tableOption = {
'border': true, 'border': true,
'index': true, 'index': true,
'stripe': true, 'stripe': true,
'menuAlign': "center", 'menuAlign': "center",
'align': "center", 'align': "center",
'menuBtn': true, 'menuBtn': true,
'editBtn': false, 'editBtn': false,
'delBtn': false, 'delBtn': false,
'addBtn': false, 'addBtn': false,
menuType: 'menu', menuType: 'menu',
'dic': [], 'dic': [],
'column': [ 'column': [
{ {
label: 'ID', label: 'ID',
prop: 'taskId', prop: 'taskId',
editDisabled: true, editDisabled: true,
addVisdiplay: false addVisdiplay: false
}, },
{ {
label: '任务名称', label: '任务名称',
prop: 'taskName', prop: 'taskName',
editDisabled: true, editDisabled: true,
addVisdiplay: false addVisdiplay: false
}, },
{ {
label: '提交时间', label: '提交时间',
prop: 'time', prop: 'time',
type: 'datetime', type: 'datetime',
format: 'yyyy-MM-dd HH:mm' format: 'yyyy-MM-dd HH:mm'
} }
] ]
} }
export const formOption = { export const formOption = {
submitBtn: false, submitBtn: false,
emptytBtn: false, emptytBtn: false,
row:true, row: true,
span:12, span: 12,
column: [ column: [
{ {
label: "任务编号", label: "任务编号",
prop: "taskId", prop: "taskId",
disabled: true disabled: true
}, },
{ {
label: "任务名称", label: "任务名称",
prop: "taskName", prop: "taskName",
disabled: true disabled: true
}, },
{ {
label: "申请人", label: "申请人",
prop: "username", prop: "username",
disabled: true disabled: true
}, },
{ {
label: "请假时长", label: "请假时长",
prop: "days", prop: "days",
disabled: true disabled: true
}, },
{ {
label: "请假时间", label: "请假时间",
prop: "createTime", prop: "createTime",
type: 'datetime', type: 'datetime',
format: 'yyyy-MM-dd HH:mm', format: 'yyyy-MM-dd HH:mm',
disabled: true disabled: true
}, },
{ {
label: '提交时间', label: '提交时间',
prop: 'time', prop: 'time',
type: 'datetime', type: 'datetime',
format: 'yyyy-MM-dd HH:mm', format: 'yyyy-MM-dd HH:mm',
disabled: true disabled: true
}, },
{ {
label: '事由', label: '事由',
prop: 'content', prop: 'content',
type:'textarea', type: 'textarea',
minRows:2, minRows: 2,
row:true, row: true,
span:24, span: 24,
disabled: true disabled: true
}, },
{ {
label: '批注', label: '批注',
prop: 'comment', prop: 'comment',
type:'textarea', type: 'textarea',
minRows:2, minRows: 2,
row:true, row: true,
span:24, span: 24,
rules: [{ rules: [{
required: true, required: true,
message: "请输入备注", message: "请输入备注",
trigger: "blur" trigger: "blur"
}] }]
} }
] ]
} }
export const taskOption = { export const taskOption = {
menu:false, menu: false,
page:false, page: false,
addBtn:false, addBtn: false,
align:'center', align: 'center',
menuAlign:'center', menuAlign: 'center',
column:[ column: [
{ {
label:'id', label: 'id',
prop:'id', prop: 'id',
hide: true hide: true
}, },
{ {
label:'用户', label: '用户',
prop:'userId' prop: 'userId'
}, },
{ {
label:'批注', label: '批注',
prop:'fullMessage' prop: 'fullMessage'
},{ }, {
label: "操作时间", label: "操作时间",
prop: "time", prop: "time",
type: "datetime", type: "datetime",
format: "yyyy-MM-dd hh:mm:ss", format: "yyyy-MM-dd hh:mm:ss",
valueFormat: "yyyy-MM-dd hh:mm:ss", valueFormat: "yyyy-MM-dd hh:mm:ss",
} }
] ]
} }
...@@ -25,16 +25,17 @@ const DIC = { ...@@ -25,16 +25,17 @@ const DIC = {
}] }]
} }
export const tableOption = { export const tableOption = {
'border': true, border: true,
'index': true, index: true,
'indexLabel': '序号', indexLabel: '序号',
'stripe': true, stripe: true,
'menuAlign': 'center', menuAlign: 'center',
'align': 'center', align: 'center',
'editBtn': false, editBtn: false,
'delBtn': false, delBtn: false,
'dic': [], viewBtn: true,
'column': [{ dic: [],
column: [{
width: 150, width: 150,
label: '编号', label: '编号',
prop: 'clientId', prop: 'clientId',
...@@ -46,11 +47,12 @@ export const tableOption = { ...@@ -46,11 +47,12 @@ export const tableOption = {
trigger: 'blur' trigger: 'blur'
}] }]
}, { }, {
width: 300,
label: '密钥', label: '密钥',
prop: 'clientSecret', prop: 'clientSecret',
align: 'center', align: 'center',
sortable: true, sortable: true,
overHidden: true,
width: 120,
rules: [{ rules: [{
required: true, required: true,
message: '请输入clientSecret', message: '请输入clientSecret',
...@@ -71,7 +73,7 @@ export const tableOption = { ...@@ -71,7 +73,7 @@ export const tableOption = {
prop: 'authorizedGrantTypes', prop: 'authorizedGrantTypes',
align: 'center', align: 'center',
width: 150, width: 150,
hide: true, overHidden: true,
rules: [{ rules: [{
required: true, required: true,
message: '请输入授权模式', message: '请输入授权模式',
...@@ -90,22 +92,20 @@ export const tableOption = { ...@@ -90,22 +92,20 @@ export const tableOption = {
width: 150, width: 150,
hide: true hide: true
}, { }, {
label: '请求令牌', label: '令牌时效',
prop: 'accessTokenValidity', prop: 'accessTokenValidity',
align: 'center', align: 'center',
width: 150, width: 80
hide: true
}, { }, {
label: '刷新令牌', label: '刷新时效',
prop: 'refreshTokenValidity', prop: 'refreshTokenValidity',
align: 'center', align: 'center',
width: 150, width: 80
hide: true
}, { }, {
label: '扩展信息', label: '扩展信息',
prop: 'additionalInformation', prop: 'additionalInformation',
align: 'center', align: 'center',
width: 150, width: 80,
hide: true hide: true
}, { }, {
label: '自动放行', label: '自动放行',
...@@ -113,7 +113,7 @@ export const tableOption = { ...@@ -113,7 +113,7 @@ export const tableOption = {
align: 'center', align: 'center',
type: 'radio', type: 'radio',
dicData: DIC.vaild, dicData: DIC.vaild,
width: 150, width: 80,
rules: [{ rules: [{
required: true, required: true,
message: '请选择是否放行', message: '请选择是否放行',
...@@ -123,6 +123,7 @@ export const tableOption = { ...@@ -123,6 +123,7 @@ export const tableOption = {
label: '资源ID', label: '资源ID',
prop: 'resourceIds', prop: 'resourceIds',
align: 'center', align: 'center',
hide: true,
width: 150 width: 150
}] }]
} }
...@@ -15,32 +15,33 @@ ...@@ -15,32 +15,33 @@
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
export const tableOption = { export const tableOption = {
'border': true, border: true,
'index': true, index: true,
'indexLabel': '序号', indexLabel: '序号',
'stripe': true, stripe: true,
'menuAlign': 'center', menuAlign: 'center',
'menuWidth': 150, menuWidth: 150,
'align': 'center', align: 'center',
'refreshBtn': true, refreshBtn: true,
'showClomnuBtn': false, showClomnuBtn: false,
'searchSize': 'mini', searchSize: 'mini',
'addBtn': false, addBtn: false,
'editBtn': false, editBtn: false,
'delBtn': false, delBtn: false,
'dicUrl': '/admin/dict/type/log_type', viewBtn: true,
dicUrl: '/admin/dict/type/log_type',
props: { props: {
label: 'label', label: 'label',
value: 'value' value: 'value'
}, },
'column': [{ column: [{
label: '类型', label: '类型',
prop: 'type', prop: 'type',
type: 'select', type: 'select',
dicData: 'log_type', dicData: 'log_type',
search: true search: true
}, { }, {
label: '请求接口名称', label: '标题',
prop: 'title' prop: 'title'
}, { }, {
label: 'IP地址', label: 'IP地址',
...@@ -52,9 +53,11 @@ export const tableOption = { ...@@ -52,9 +53,11 @@ export const tableOption = {
label: '客户端', label: '客户端',
prop: 'serviceId' prop: 'serviceId'
}, { }, {
width: 80,
label: '请求时间', label: '请求时间',
prop: 'time' prop: 'time'
}, { }, {
width: 150,
label: '创建时间', label: '创建时间',
prop: 'createTime', prop: 'createTime',
type: 'datetime', type: 'datetime',
......
...@@ -15,74 +15,74 @@ ...@@ -15,74 +15,74 @@
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
export const tableOption = { export const tableOption = {
border: true, border: true,
index: true, index: true,
indexLabel: '序号', indexLabel: '序号',
stripe: true, stripe: true,
menuAlign: 'center', menuAlign: 'center',
editBtn: false, editBtn: false,
delBtn: false, delBtn: false,
align: 'center', align: 'center',
addBtn: false, addBtn: false,
column: [{ column: [{
fixed: true, fixed: true,
label: 'id', label: 'id',
prop: 'roleId', prop: 'roleId',
span: 24, span: 24,
editDisabled: true, editDisabled: true,
addVisdiplay: false, addVisdiplay: false,
}, { }, {
fixed: true, fixed: true,
label: '角色名称', label: '角色名称',
prop: 'roleName', prop: 'roleName',
span: 24, span: 24,
rules: [{ rules: [{
required: true, required: true,
message: '角色名称不能为空', message: '角色名称不能为空',
trigger: 'blur' trigger: 'blur'
}, },
{ {
min: 3, min: 3,
max: 20, max: 20,
message: '长度在 3 到 20 个字符', message: '长度在 3 到 20 个字符',
trigger: 'blur' trigger: 'blur'
} }
] ]
}, { }, {
width: 150, width: 150,
label: '角色标识', label: '角色标识',
prop: 'roleCode', prop: 'roleCode',
span: 24, span: 24,
editDisabled: true, editDisabled: true,
rules: [{ rules: [{
required: true, required: true,
message: '角色标识不能为空', message: '角色标识不能为空',
trigger: 'blur' trigger: 'blur'
}, },
{ {
min: 3, min: 3,
max: 20, max: 20,
message: '长度在 3 到 20 个字符', message: '长度在 3 到 20 个字符',
trigger: 'blur' trigger: 'blur'
} }
] ]
}, { }, {
width: 180, width: 180,
label: '角色描述', label: '角色描述',
prop: 'roleDesc', prop: 'roleDesc',
overHidden: true, overHidden: true,
type: 'textarea', type: 'textarea',
minRows: 6, minRows: 6,
span: 24, span: 24,
}, { }, {
width: 180, width: 180,
label: '创建时间', label: '创建时间',
prop: 'createTime', prop: 'createTime',
type: 'datetime', type: 'datetime',
format: 'yyyy-MM-dd HH:mm', format: 'yyyy-MM-dd HH:mm',
valueFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss',
editDisabled: true, editDisabled: true,
addVisdiplay: false, addVisdiplay: false,
span: 24, span: 24,
}] }]
} }
...@@ -16,73 +16,77 @@ ...@@ -16,73 +16,77 @@
*/ */
export const tableOption = { export const tableOption = {
"border": true, border: true,
"index": true, index: true,
"stripe": true, stripe: true,
"menuAlign": "center", menuAlign: "center",
"align": "center", align: "center",
"editBtn": false, editBtn: false,
"delBtn": false, delBtn: false,
"addBtn": false, addBtn: false,
'dicUrl': '/admin/dict/type/social_type', viewBtn: true,
"column": [{ dicUrl: '/admin/dict/type/social_type',
label: 'ID', column: [{
prop: 'id', label: 'ID',
hide: true, prop: 'id',
addVisdiplay: false, hide: true,
editDisabled: true addVisdiplay: false,
}, editDisabled: true
{ },
label: '类型', {
prop: 'type', label: '类型',
type: 'select', prop: 'type',
dicData: 'social_type', type: 'select',
search: true, dicData: 'social_type',
rules: [{ search: true,
required: true, rules: [{
message: '请选择类型', required: true,
trigger: 'blur' message: '请选择类型',
}] trigger: 'blur'
}, }]
{ },
label: '描述', {
prop: 'remark' label: '描述',
}, prop: 'remark'
{ },
label: 'appId', {
prop: 'appId', label: 'appId',
rules: [{ prop: 'appId',
required: true, overHidden: true,
message: '请输入appId', rules: [{
trigger: 'blur' required: true,
}] message: '请输入appId',
}, trigger: 'blur'
{ }]
label: 'appSecret', },
prop: 'appSecret', {
rules: [{ label: 'appSecret',
required: true, prop: 'appSecret',
message: '请输入appSecret', overHidden: true,
trigger: 'blur' rules: [{
}] required: true,
}, message: '请输入appSecret',
{ trigger: 'blur'
label: '回调地址', }]
prop: 'redirectUrl', },
rules: [{ {
required: true, label: '回调地址',
message: '请输入回调地址', prop: 'redirectUrl',
trigger: 'blur' hide: true,
}] rules: [{
}, required: true,
{ message: '请输入回调地址',
valueFormat: 'timestamp', trigger: 'blur'
format: 'yyyy-MM-dd hh:mm:ss', }]
label: '创建时间', },
prop: 'createTime', {
align: 'center', valueFormat: 'timestamp',
addVisdiplay: false, format: 'yyyy-MM-dd hh:mm:ss',
editDisabled: true label: '创建时间',
} prop: 'createTime',
] align: 'center',
} addVisdiplay: false,
\ No newline at end of file editDisabled: true
}
]
}
...@@ -16,53 +16,54 @@ ...@@ -16,53 +16,54 @@
*/ */
const DIC = { const DIC = {
vaild: [{ vaild: [{
label: '否', label: '否',
value: 'false' value: 'false'
}, { }, {
label: '是', label: '是',
value: 'true' value: 'true'
}] }]
} }
export const tableOption = { export const tableOption = {
'border': true, border: true,
'index': true, index: true,
'indexLabel': '序号', indexLabel: '序号',
'stripe': true, stripe: true,
'menuAlign': 'center', menuAlign: 'center',
'align': 'center', align: 'center',
'addBtn': false, viewBtn: true,
'editBtn': false, addBtn: false,
'delBtn': false, editBtn: false,
'dic': [], delBtn: false,
'column': [{ dic: [],
label: '用户ID', column: [{
prop: 'user_id', label: '用户ID',
align: 'center' prop: 'user_id',
}, { align: 'center'
label: '用户名', }, {
prop: 'user_name', label: '用户名',
align: 'center' prop: 'user_name',
}, { align: 'center'
label: '令牌', }, {
prop: 'token_value', label: '令牌',
align: 'center', prop: 'token_value',
'overHidden': true align: 'center',
}, { 'overHidden': true
label: '类型', }, {
prop: 'token_type', label: '类型',
align: 'center' prop: 'token_type',
}, { align: 'center'
label: '过期时间', }, {
prop: 'expires_in', label: '过期时间',
align: 'center' prop: 'expires_in',
}, { align: 'center'
label: '客户端', }, {
prop: 'client_id', label: '客户端',
align: 'center' prop: 'client_id',
}, { align: 'center'
label: '授权类型', }, {
prop: 'grant_type', label: '授权类型',
align: 'center' prop: 'grant_type',
}] align: 'center'
}]
} }
...@@ -14,132 +14,133 @@ ...@@ -14,132 +14,133 @@
* this software without specific prior written permission. * this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
import { getDetails } from "@/api/admin/user"; import {getDetails} from "@/api/admin/user";
var validateUsername = (rule, value, callback) => { var validateUsername = (rule, value, callback) => {
getDetails(value).then(response => { getDetails(value).then(response => {
if (window.boxType === 'edit') callback() if (window.boxType === 'edit') callback()
let result = response.data.data let result = response.data.data
if (result !== null) { if (result !== null) {
callback(new Error('用户名已经存在')) callback(new Error('用户名已经存在'))
} else { } else {
callback() callback()
} }
}); });
}; };
export const tableOption = { export const tableOption = {
border: true, border: true,
index: true, index: true,
indexLabel: '序号', indexLabel: '序号',
stripe: true, stripe: true,
menuAlign: 'center', menuAlign: 'center',
editBtn: false, editBtn: false,
delBtn: false, delBtn: false,
align: 'center', align: 'center',
addBtn: false, addBtn: false,
column: [{ column: [{
fixed: true, fixed: true,
label: 'id', label: 'id',
prop: 'userId', prop: 'userId',
span: 24, span: 24,
hide: true, hide: true,
editDisabled: true, editDisabled: true,
addVisdiplay: false, addVisdiplay: false,
}, { }, {
fixed: true, fixed: true,
label: '用户名', label: '用户名',
prop: 'username', prop: 'username',
editDisabled: true, editDisabled: true,
solt: true, solt: true,
search: true, search: true,
span: 24, span: 24,
rules: [{ rules: [{
required: true, required: true,
message: "请输入用户名", message: "请输入用户名",
}, },
{ {
min: 3, min: 3,
max: 20, max: 20,
message: "长度在 3 到 20 个字符", message: "长度在 3 到 20 个字符",
trigger: "blur" trigger: "blur"
}, },
{ validator: validateUsername, trigger: 'blur' } {validator: validateUsername, trigger: 'blur'}
] ]
}, { }, {
label: '密码', label: '密码',
prop: 'password', prop: 'password',
type: 'password', type: 'password',
value: '', value: '',
hide: true, hide: true,
span: 24, span: 24,
rules: [{ rules: [{
min: 6, min: 6,
max: 20, max: 20,
message: "长度在 6 到 20 个字符", message: "长度在 6 到 20 个字符",
trigger: "blur" trigger: "blur"
}] }]
}, { }, {
label: '所属部门', label: '所属部门',
prop: 'deptId', prop: 'deptId',
formsolt: true, formsolt: true,
solt: true, solt: true,
span: 24, span: 24,
hide: true, hide: true,
rules: [{ rules: [{
required: true, required: true,
message: "请选择部门", message: "请选择部门",
trigger: "blur" trigger: "blur"
}] }]
}, { }, {
label: '手机号', label: '手机号',
prop: 'phone', prop: 'phone',
type: 'phone', type: 'phone',
value: '', value: '',
span: 24, span: 24,
rules: [{ rules: [{
min: 6, min: 6,
max: 20, max: 20,
message: "长度在 11 个字符", message: "长度在 11 个字符",
trigger: "blur" trigger: "blur"
}] }]
},{ }, {
label: '角色', label: '角色',
prop: 'role', prop: 'role',
formsolt: true, formsolt: true,
solt: true, solt: true,
overHidden: true, overHidden: true,
span: 24, span: 24,
rules: [{ rules: [{
required: true, required: true,
message: "请选择角色", message: "请选择角色",
trigger: "blur" trigger: "blur"
}], }],
}, { }, {
label: '状态', label: '状态',
prop: "lockFlag", prop: "lockFlag",
type: "select", type: "select",
solt: true, solt: true,
span: 24, span: 24,
rules: [{ rules: [{
required: true, required: true,
message: "请选择状态", message: "请选择状态",
trigger: "blur" trigger: "blur"
}], }],
dicData: [{ dicData: [{
label: '有效', label: '有效',
value: "0" value: "0"
}, {
label: '锁定',
value: "9"
}]
}, { }, {
width: 180, label: '锁定',
label: '创建时间', value: "9"
prop: 'createTime',
type: 'datetime',
format: 'yyyy-MM-dd HH:mm',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
editDisabled: true,
addVisdiplay: false,
span: 24
}] }]
}, {
width: 180,
label: '创建时间',
prop: 'createTime',
type: 'datetime',
format: 'yyyy-MM-dd HH:mm',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
editDisabled: true,
addVisdiplay: false,
span: 24
}]
} }
...@@ -15,84 +15,84 @@ ...@@ -15,84 +15,84 @@
* Author: lengleng (wangiegie@gmail.com) * Author: lengleng (wangiegie@gmail.com)
*/ */
const DIC = { const DIC = {
isSuccess: [{ isSuccess: [{
label: '成功', label: '成功',
value: 1 value: 1
}, },
{ {
label: '失败', label: '失败',
value: 0 value: 0
} }
] ]
} }
export const tableOption = { export const tableOption = {
'border': true, 'border': true,
'index': true, 'index': true,
'indexLabel': '序号', 'indexLabel': '序号',
'stripe': true, 'stripe': true,
'menuAlign': "center", 'menuAlign': "center",
'align': "center", 'align': "center",
'editBtn': false, 'editBtn': false,
'delBtn': false, 'delBtn': false,
'addBtn': false, 'addBtn': false,
'viewBtn':true, 'viewBtn': true,
'dic': [], 'dic': [],
'column': [ 'column': [
{ {
label: 'ID', label: 'ID',
prop: 'id', prop: 'id',
hide: true hide: true
}, },
{ {
label: '任务名称', label: '任务名称',
prop: 'jobName' prop: 'jobName'
}, },
{ {
label: '任务ID', label: '任务ID',
prop: 'taskId', prop: 'taskId',
hide: true, hide: true,
overHidden: true overHidden: true
}, },
{ {
label: '主机名', label: '主机名',
prop: 'hostname', prop: 'hostname',
hide: true hide: true
}, },
{ {
label: 'IP', label: 'IP',
prop: 'ip' prop: 'ip'
}, },
{ {
width: 80, width: 80,
label: '分片项', label: '分片项',
prop: 'shardingItem' prop: 'shardingItem'
}, },
{ {
label: '执行源', label: '执行源',
prop: 'executionSource', prop: 'executionSource',
hide: true hide: true
}, },
{ {
label: '失败原因', label: '失败原因',
prop: 'failureCause', prop: 'failureCause',
hide: true hide: true
}, },
{ {
width: 100, width: 100,
label: '执行结果', label: '执行结果',
prop: 'isSuccess', prop: 'isSuccess',
type: 'select', type: 'select',
dicData: DIC.isSuccess, dicData: DIC.isSuccess,
}, },
{ {
label: '开始时间', label: '开始时间',
prop: 'startTime', prop: 'startTime',
hide: true hide: true
}, },
{ {
label: '完成时间', label: '完成时间',
prop: 'completeTime' prop: 'completeTime'
}, },
] ]
} }
...@@ -16,89 +16,89 @@ ...@@ -16,89 +16,89 @@
*/ */
const DIC = { const DIC = {
state: [{ state: [{
label: '准备中', label: '准备中',
value: 'TASK_STAGING' value: 'TASK_STAGING'
}, },
{ {
label: '执行中', label: '执行中',
value: 'TASK_RUNNING' value: 'TASK_RUNNING'
}, { }, {
label: '已经完成', label: '已经完成',
value: 'TASK_FINISHED' value: 'TASK_FINISHED'
} }
] ]
} }
export const tableOption = { export const tableOption = {
"border": true, "border": true,
"index": true, "index": true,
"stripe": true, "stripe": true,
"menuAlign": "center", "menuAlign": "center",
"align": "center", "align": "center",
"editBtn": false, "editBtn": false,
"delBtn": false, "delBtn": false,
"addBtn": false, "addBtn": false,
"viewBtn": true, "viewBtn": true,
"dic": [], "dic": [],
"column": [{ "column": [{
label: 'ID', label: 'ID',
prop: 'id', prop: 'id',
hide: true hide: true
},
{
label: '作业名称',
prop: 'jobName',
search: true
},
{
label: '原任务',
prop: 'originalTaskId',
hide: true,
width: 100
},
{
label: '任务ID',
prop: 'taskId',
hide: true
},
{
label: '服务器IP',
prop: 'slaveId'
},
{
label: '资源',
prop: 'source',
hide: true
},
{
label: '执行类型',
prop: 'executionType',
hide: true
},
{
width: 100,
label: '分片项',
prop: 'shardingItem'
},
{
width: 100,
label: '状态',
prop: 'state',
type: 'select',
dicData: DIC.state,
search: true
},
{
label: '消息',
prop: 'message',
width: 100,
overHidden: true,
hide: true
}, },
{ {
label: '作业名称', label: '创建时间',
prop: 'jobName', prop: 'creationTime'
search: true }
}, ]
{
label: '原任务',
prop: 'originalTaskId',
hide: true,
width: 100
},
{
label: '任务ID',
prop: 'taskId',
hide: true
},
{
label: '服务器IP',
prop: 'slaveId'
},
{
label: '资源',
prop: 'source',
hide: true
},
{
label: '执行类型',
prop: 'executionType',
hide: true
},
{
width: 100,
label: '分片项',
prop: 'shardingItem'
},
{
width: 100,
label: '状态',
prop: 'state',
type: 'select',
dicData: DIC.state,
search: true
},
{
label: '消息',
prop: 'message',
width: 100,
overHidden: true,
hide: true
},
{
label: '创建时间',
prop: 'creationTime'
}
]
} }
...@@ -16,66 +16,66 @@ ...@@ -16,66 +16,66 @@
*/ */
export const tableOption = { export const tableOption = {
'border': true, 'border': true,
'index': true, 'index': true,
'expand': true, 'expand': true,
'stripe': true, 'stripe': true,
'selection': true, 'selection': true,
'page': false, 'page': false,
'menuAlign': 'center', 'menuAlign': 'center',
'defaultSort': { 'defaultSort': {
prop: 'username', prop: 'username',
order: 'descending' order: 'descending'
}, },
'align': 'center', 'align': 'center',
'dic': [], 'dic': [],
'column': [{ 'column': [{
'label': '用户名', 'label': '用户名',
'prop': 'username', 'prop': 'username',
'span': 24, 'span': 24,
'solt': true, 'solt': true,
'sortable': true, 'sortable': true,
'width': 120, 'width': 120,
'rules': [{ 'rules': [{
'required': true, 'required': true,
'message': '请输入用户名', 'message': '请输入用户名',
'trigger': 'blur' 'trigger': 'blur'
}] }]
}, { }, {
'label': '类型', 'label': '类型',
'prop': 'type', 'prop': 'type',
'width': 80, 'width': 80,
'type': 'select', 'type': 'select',
'sortable': true, 'sortable': true,
'dicData': [{ 'dicData': [{
'label': '后端', 'label': '后端',
'value': '0' 'value': '0'
}, {
'label': '前端',
'value': '1'
}]
}, {
'label': 'stars',
'width': '150',
'prop': 'stars',
'sortable': true,
'solt': true
}, {
'label': '码云',
'solt': true,
'span': 24,
'prop': 'address',
'type': 'textarea',
'overHidden': true
}, { }, {
'label': '项目介绍', 'label': '前端',
'width': '300', 'value': '1'
'prop': 'info',
'editDisabled': true,
'type': 'textarea',
'span': 24,
'maxRow': 4,
'minRow': 4,
'overHidden': true
}] }]
} }, {
\ No newline at end of file 'label': 'stars',
'width': '150',
'prop': 'stars',
'sortable': true,
'solt': true
}, {
'label': '码云',
'solt': true,
'span': 24,
'prop': 'address',
'type': 'textarea',
'overHidden': true
}, {
'label': '项目介绍',
'width': '300',
'prop': 'info',
'editDisabled': true,
'type': 'textarea',
'span': 24,
'maxRow': 4,
'minRow': 4,
'overHidden': true
}]
}
export const DIC = { export const DIC = {
VAILD: [{ VAILD: [{
label: '真', label: '真',
value: 'true', value: 'true',
color: 'green' color: 'green'
}, { }, {
label: '假', label: '假',
value: 'false', value: 'false',
color: 'red' color: 'red'
}], }],
SEX: [{ SEX: [{
label: '男', label: '男',
value: 0, value: 0,
color: 'green' color: 'green'
}, { }, {
label: '女', label: '女',
value: 1, value: 1,
color: 'red' color: 'red'
}], }],
POSTIONDATA: [{ POSTIONDATA: [{
label: '左对齐', label: '左对齐',
value: 'left' value: 'left'
}, { }, {
label: '居中', label: '居中',
value: 'center' value: 'center'
}, { }, {
label: '右对齐', label: '右对齐',
value: 'right' value: 'right'
}], }],
TYPE: [{ TYPE: [{
label: '一级1', label: '一级1',
value: 0, value: 0,
children: [{ children: [{
label: '一级1二级1', label: '一级1二级1',
value: 2, value: 2,
}] }]
}, { }, {
label: '一级2', label: '一级2',
value: 1, value: 1,
children: [{ children: [{
label: '一级2二级1', label: '一级2二级1',
value: 2, value: 2,
}] }]
} }
], ],
STATE: [{ STATE: [{
label: '有效', label: '有效',
value: 0 value: 0
}, {
label: '无效',
value: 1
}],
GRADE: [{
label: "管理员",
value: 0
},
{
label: "二级管理员",
value: 1
}
],
VAILDATA: [{
label: "激活",
value: true,
},
{
label: "禁用",
value: false,
}
],
CRUDTYPE: [{
label: "输入框",
value: ''
}, {
label: "选择框",
value: 'select'
},
{
label: "文本框",
value: 'text'
},
{
label: "密码框",
value: 'password'
},
{
label: "树型框",
value: 'tree'
},
{
label: "富文本编辑框",
value: 'ueditor'
},
{
label: "多行文本框",
value: 'textarea'
},
{
label: "单选框",
value: 'radio'
},
{
label: "多选框",
value: 'checkbox'
},
{
label: "数字框",
value: 'number'
},
{
label: "日期框",
value: 'date'
},
{
label: "日期范围框",
value: 'daterange'
},
{
label: "时间范围框",
value: 'datetimerange'
},
{
label: "时间框",
value: 'datetime'
},
{
label: "周",
value: 'week'
},
{
label: "月",
value: 'month'
},
{
label: "年",
value: 'year'
},
{
label: "滑动框",
value: 'silder'
},
{
label: "评价框",
value: 'rate'
},
{
label: "上传框",
value: 'upload'
}
],
UITYPE: [{
value: 'zhinan',
label: '指南',
children: [{
value: 'shejiyuanze',
label: '设计原则',
children: [{
value: 'yizhi',
label: '一致'
}, {
value: 'fankui',
label: '反馈'
}, {
value: 'xiaolv',
label: '效率'
}, {
value: 'kekong',
label: '可控'
}]
}, {
value: 'daohang',
label: '导航',
children: [{
value: 'cexiangdaohang',
label: '侧向导航'
}, {
value: 'dingbudaohang',
label: '顶部导航'
}]
}]
}, {
value: 'zujian',
label: '组件',
children: [{
value: 'basic',
label: 'Basic',
children: [{
value: 'layout',
label: 'Layout 布局'
}, {
value: 'color',
label: 'Color 色彩'
}, {
value: 'typography',
label: 'Typography 字体'
}, {
value: 'icon',
label: 'Icon 图标'
}, {
value: 'button',
label: 'Button 按钮'
}]
}, { }, {
label: '无效', value: 'form',
value: 1 label: 'Form',
}], children: [{
GRADE: [{ value: 'radio',
label: "管理员", label: 'Radio 单选框'
value: 0 }, {
}, value: 'checkbox',
{ label: 'Checkbox 多选框'
label: "二级管理员", }, {
value: 1 value: 'input',
} label: 'Input 输入框'
], }, {
VAILDATA: [{ value: 'input-number',
label: "激活", label: 'InputNumber 计数器'
value: true, }, {
}, value: 'select',
{ label: 'Select 选择器'
label: "禁用", }, {
value: false, value: 'cascader',
} label: 'Cascader 级联选择器'
], }, {
CRUDTYPE: [{ value: 'switch',
label: "输入框", label: 'Switch 开关'
value: '' }, {
}, { value: 'slider',
label: "选择框", label: 'Slider 滑块'
value: 'select' }, {
}, value: 'time-picker',
{ label: 'TimePicker 时间选择器'
label: "文本框", }, {
value: 'text' value: 'date-picker',
}, label: 'DatePicker 日期选择器'
{ }, {
label: "密码框", value: 'datetime-picker',
value: 'password' label: 'DateTimePicker 日期时间选择器'
}, }, {
{ value: 'upload',
label: "树型框", label: 'Upload 上传'
value: 'tree' }, {
}, value: 'rate',
{ label: 'Rate 评分'
label: "富文本编辑框", }, {
value: 'ueditor' value: 'form',
}, label: 'Form 表单'
{ }]
label: "多行文本框",
value: 'textarea'
},
{
label: "单选框",
value: 'radio'
},
{
label: "多选框",
value: 'checkbox'
},
{
label: "数字框",
value: 'number'
},
{
label: "日期框",
value: 'date'
},
{
label: "日期范围框",
value: 'daterange'
},
{
label: "时间范围框",
value: 'datetimerange'
},
{
label: "时间框",
value: 'datetime'
},
{
label: "周",
value: 'week'
},
{
label: "月",
value: 'month'
},
{
label: "年",
value: 'year'
},
{
label: "滑动框",
value: 'silder'
},
{
label: "评价框",
value: 'rate'
},
{
label: "上传框",
value: 'upload'
}
],
UITYPE: [{
value: 'zhinan',
label: '指南',
children: [{
value: 'shejiyuanze',
label: '设计原则',
children: [{
value: 'yizhi',
label: '一致'
}, {
value: 'fankui',
label: '反馈'
}, {
value: 'xiaolv',
label: '效率'
}, {
value: 'kekong',
label: '可控'
}]
}, {
value: 'daohang',
label: '导航',
children: [{
value: 'cexiangdaohang',
label: '侧向导航'
}, {
value: 'dingbudaohang',
label: '顶部导航'
}]
}]
}, { }, {
value: 'zujian', value: 'data',
label: '组件', label: 'Data',
children: [{ children: [{
value: 'basic', value: 'table',
label: 'Basic', label: 'Table 表格'
children: [{ }, {
value: 'layout', value: 'tag',
label: 'Layout 布局' label: 'Tag 标签'
}, { }, {
value: 'color', value: 'progress',
label: 'Color 色彩' label: 'Progress 进度条'
}, { }, {
value: 'typography', value: 'tree',
label: 'Typography 字体' label: 'Tree 树形控件'
}, { }, {
value: 'icon', value: 'pagination',
label: 'Icon 图标' label: 'Pagination 分页'
}, { }, {
value: 'button', value: 'badge',
label: 'Button 按钮' label: 'Badge 标记'
}] }]
}, {
value: 'form',
label: 'Form',
children: [{
value: 'radio',
label: 'Radio 单选框'
}, {
value: 'checkbox',
label: 'Checkbox 多选框'
}, {
value: 'input',
label: 'Input 输入框'
}, {
value: 'input-number',
label: 'InputNumber 计数器'
}, {
value: 'select',
label: 'Select 选择器'
}, {
value: 'cascader',
label: 'Cascader 级联选择器'
}, {
value: 'switch',
label: 'Switch 开关'
}, {
value: 'slider',
label: 'Slider 滑块'
}, {
value: 'time-picker',
label: 'TimePicker 时间选择器'
}, {
value: 'date-picker',
label: 'DatePicker 日期选择器'
}, {
value: 'datetime-picker',
label: 'DateTimePicker 日期时间选择器'
}, {
value: 'upload',
label: 'Upload 上传'
}, {
value: 'rate',
label: 'Rate 评分'
}, {
value: 'form',
label: 'Form 表单'
}]
}, {
value: 'data',
label: 'Data',
children: [{
value: 'table',
label: 'Table 表格'
}, {
value: 'tag',
label: 'Tag 标签'
}, {
value: 'progress',
label: 'Progress 进度条'
}, {
value: 'tree',
label: 'Tree 树形控件'
}, {
value: 'pagination',
label: 'Pagination 分页'
}, {
value: 'badge',
label: 'Badge 标记'
}]
}, {
value: 'notice',
label: 'Notice',
children: [{
value: 'alert',
label: 'Alert 警告'
}, {
value: 'loading',
label: 'Loading 加载'
}, {
value: 'message',
label: 'Message 消息提示'
}, {
value: 'message-box',
label: 'MessageBox 弹框'
}, {
value: 'notification',
label: 'Notification 通知'
}]
}, {
value: 'navigation',
label: 'Navigation',
children: [{
value: 'menu',
label: 'NavMenu 导航菜单'
}, {
value: 'tabs',
label: 'Tabs 标签页'
}, {
value: 'breadcrumb',
label: 'Breadcrumb 面包屑'
}, {
value: 'dropdown',
label: 'Dropdown 下拉菜单'
}, {
value: 'steps',
label: 'Steps 步骤条'
}]
}, {
value: 'others',
label: 'Others',
children: [{
value: 'dialog',
label: 'Dialog 对话框'
}, {
value: 'tooltip',
label: 'Tooltip 文字提示'
}, {
value: 'popover',
label: 'Popover 弹出框'
}, {
value: 'card',
label: 'Card 卡片'
}, {
value: 'carousel',
label: 'Carousel 走马灯'
}, {
value: 'collapse',
label: 'Collapse 折叠面板'
}]
}]
}, { }, {
value: 'ziyuan', value: 'notice',
label: '资源', label: 'Notice',
children: [{ children: [{
value: 'axure', value: 'alert',
label: 'Axure Components' label: 'Alert 警告'
}, { }, {
value: 'sketch', value: 'loading',
label: 'Sketch Templates' label: 'Loading 加载'
}, { }, {
value: 'jiaohu', value: 'message',
label: '组件交互文档' label: 'Message 消息提示'
}] }, {
}], value: 'message-box',
PAYTYPE: [{ label: 'MessageBox 弹框'
label: '微信', }, {
value: '0', value: 'notification',
label: 'Notification 通知'
}]
}, { }, {
label: '支付宝', value: 'navigation',
value: '1', label: 'Navigation',
children: [{
value: 'menu',
label: 'NavMenu 导航菜单'
}, {
value: 'tabs',
label: 'Tabs 标签页'
}, {
value: 'breadcrumb',
label: 'Breadcrumb 面包屑'
}, {
value: 'dropdown',
label: 'Dropdown 下拉菜单'
}, {
value: 'steps',
label: 'Steps 步骤条'
}]
}, { }, {
label: '银行卡', value: 'others',
value: '2', label: 'Others',
}], children: [{
DATALIST: [{ value: 'dialog',
label: 'SEX', label: 'Dialog 对话框'
value: 'SEX', }, {
value: 'tooltip',
label: 'Tooltip 文字提示'
}, {
value: 'popover',
label: 'Popover 弹出框'
}, {
value: 'card',
label: 'Card 卡片'
}, {
value: 'carousel',
label: 'Carousel 走马灯'
}, {
value: 'collapse',
label: 'Collapse 折叠面板'
}]
}]
}, {
value: 'ziyuan',
label: '资源',
children: [{
value: 'axure',
label: 'Axure Components'
}, { }, {
label: 'STATE', value: 'sketch',
value: 'STATE', label: 'Sketch Templates'
}, { }, {
label: 'GRADE', value: 'jiaohu',
value: 'GRADE', label: '组件交互文档'
}] }]
} }],
\ No newline at end of file PAYTYPE: [{
label: '微信',
value: '0',
}, {
label: '支付宝',
value: '1',
}, {
label: '银行卡',
value: '2',
}],
DATALIST: [{
label: 'SEX',
value: 'SEX',
}, {
label: 'STATE',
value: 'STATE',
}, {
label: 'GRADE',
value: 'GRADE',
}]
}
export default { export default {
'000': '操作太频繁,请勿重复请求', '000': '操作太频繁,请勿重复请求',
'401': '当前操作没有权限', '401': '当前操作没有权限',
'403': '当前操作没有权限', '403': '当前操作没有权限',
'404': '资源不存在', '404': '资源不存在',
'417': '未绑定登录账号,请使用密码登录后绑定', '417': '未绑定登录账号,请使用密码登录后绑定',
'423': '演示环境不能操作,如需了解联系冷冷', '423': '演示环境不能操作,如需了解联系冷冷',
'426': '用户名不存在或密码错误', '426': '用户名不存在或密码错误',
'428': '验证码错误,请重新输入', '428': '验证码错误,请重新输入',
'429': '请求过频繁', '429': '请求过频繁',
'479': '演示环境,没有权限操作', '479': '演示环境,没有权限操作',
'default': '系统未知错误,请反馈给管理员' 'default': '系统未知错误,请反馈给管理员'
} }
\ No newline at end of file
export default { export default {
menu: false, menu: false,
addBtn: false, addBtn: false,
page: false, page: false,
border: true, border: true,
expand: true, expand: true,
refreshBtn: false, refreshBtn: false,
headerAlign: 'center', headerAlign: 'center',
column: [{ column: [{
label: '类型', label: '类型',
prop: 'type', prop: 'type',
width: 80, width: 80,
align: 'center', align: 'center',
solt: true, solt: true,
dicData: [{ dicData: [{
label: 'bug', label: 'bug',
value: 'error' value: 'error'
}]
}, {
label: '地址',
width: 200,
prop: 'url',
overHidden: true,
}, {
label: '内容',
prop: 'message',
overHidden: true,
}, {
label: '错误堆栈',
prop: 'stack',
hide: true
}, {
label: '时间',
align: 'center',
prop: 'time',
width: 200,
}] }]
} }, {
\ No newline at end of file label: '地址',
width: 200,
prop: 'url',
overHidden: true,
}, {
label: '内容',
prop: 'message',
overHidden: true,
}, {
label: '错误堆栈',
prop: 'stack',
hide: true
}, {
label: '时间',
align: 'center',
prop: 'time',
width: 200,
}]
}
const dicData = [{ const dicData = [{
label: '开启', label: '开启',
value: 'true' value: 'true'
}, { }, {
label: '关闭', label: '关闭',
value: 'false' value: 'false'
}] }]
export const list = [{ export const list = [{
key: 'showTag', key: 'showTag',
commit: 'SET_SHOWTAG' commit: 'SET_SHOWTAG'
}, { }, {
key: 'showTheme', key: 'showTheme',
commit: 'SET_SHOWTHEME' commit: 'SET_SHOWTHEME'
}, { }, {
key: 'showColor', key: 'showColor',
commit: 'SET_SHOWCOLOR' commit: 'SET_SHOWCOLOR'
}, { }, {
key: 'showLock', key: 'showLock',
commit: 'SET_SHOWLOCK' commit: 'SET_SHOWLOCK'
}, { }, {
key: 'showDebug', key: 'showDebug',
commit: 'SET_SHOWDEBUG' commit: 'SET_SHOWDEBUG'
}, { }, {
key: 'showFullScren', key: 'showFullScren',
commit: 'SET_SHOWFULLSCREN' commit: 'SET_SHOWFULLSCREN'
}, { }, {
key: 'showCollapse', key: 'showCollapse',
commit: 'SET_SHOWCOLLAPSE' commit: 'SET_SHOWCOLLAPSE'
}, { }, {
key: 'showSearch', key: 'showSearch',
commit: 'SET_SHOWSEARCH' commit: 'SET_SHOWSEARCH'
}, { }, {
key: 'showMenu', key: 'showMenu',
commit: 'SET_SHOWMENU' commit: 'SET_SHOWMENU'
}] }]
export const option = (safe) => { export const option = (safe) => {
const _safe = safe; const _safe = safe;
return { return {
submitBtn: false, submitBtn: false,
column: [{ column: [{
label: '标签', label: '标签',
prop: 'showTag', prop: 'showTag',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}, { }, {
label: '日志', label: '日志',
prop: 'showDebug', prop: 'showDebug',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}, { }, {
label: '主题', label: '主题',
prop: 'showTheme', prop: 'showTheme',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}, { }, {
label: '主题色', label: '主题色',
prop: 'showColor', prop: 'showColor',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}, { }, {
label: '全屏', label: '全屏',
prop: 'showFullScren', prop: 'showFullScren',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}, { }, {
label: '锁屏', label: '锁屏',
prop: 'showLock', prop: 'showLock',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}, { }, {
label: '搜索', label: '搜索',
prop: 'showSearch', prop: 'showSearch',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}, { }, {
label: '缩放', label: '缩放',
prop: 'showCollapse', prop: 'showCollapse',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}, { }, {
label: '顶部菜单', label: '顶部菜单',
prop: 'showMenu', prop: 'showMenu',
type: 'switch', type: 'switch',
span: 24, span: 24,
dicData: dicData, dicData: dicData,
click: ({ column }) => { click: ({column}) => {
_safe.set(column.prop); _safe.set(column.prop);
} }
}] }]
} }
} }
\ No newline at end of file
export default { export default {
title: "PigX", title: "PigX",
logo: "PigX", logo: "PigX",
indexTitle: 'PigX Pro 快速开发框架', indexTitle: 'PigX Pro 快速开发框架',
whiteList: ["/login", "/404", "/401", "/lock"], //配置无权限可以访问的页面 whiteList: ["/login", "/404", "/401", "/lock"], //配置无权限可以访问的页面
whiteTagList: ["/login", "/404", "/401", "/lock", ], //配置不添加tags页面 ('/advanced-router/mutative-detail/*'——*为通配符) whiteTagList: ["/login", "/404", "/401", "/lock",], //配置不添加tags页面 ('/advanced-router/mutative-detail/*'——*为通配符)
lockPage: '/lock', lockPage: '/lock',
tokenTime: 6000, tokenTime: 6000,
info: { info: {
title: "PigX Pro 快速开发框架", title: "PigX Pro 快速开发框架",
list: [ list: [
'一个基于Spring Cloud、OAuth2.0开发基于Vue前后分离的开发平台。', '一个基于Spring Cloud、OAuth2.0开发基于Vue前后分离的开发平台。',
'一个基于Avue2 开发无需前端知识,即可快速上手的开发平台。', '一个基于Avue2 开发无需前端知识,即可快速上手的开发平台。',
'最大程度上帮助企业节省时间成本和费用开支。', '最大程度上帮助企业节省时间成本和费用开支。',
'QQ群:23754102', 'QQ群:23754102',
'当前版本:v2.0.0', '当前版本:v2.0.0',
] ]
}, },
//http的status默认放行不才用统一处理的, //http的status默认放行不才用统一处理的,
statusWhiteList: [400, 500, 401], statusWhiteList: [400, 500, 401],
//配置首页不可关闭 //配置首页不可关闭
isFirstPage: false, isFirstPage: false,
fistPage: { fistPage: {
label: "首页", label: "首页",
value: "/wel/index", value: "/wel/index",
params: {}, params: {},
query: {}, query: {},
group: [], group: [],
close: false close: false
}, },
//配置菜单的属性 //配置菜单的属性
menu: { menu: {
props: { props: {
label: 'label', label: 'label',
path: 'path', path: 'path',
icon: 'icon', icon: 'icon',
children: 'children' children: 'children'
}
} }
} }
\ No newline at end of file }
import Vue from 'vue'; import Vue from 'vue';
import store from './store' import store from './store'
Vue.config.errorHandler = function(err, vm, info) {
Vue.nextTick(() => { Vue.config.errorHandler = function (err, vm, info) {
store.commit('ADD_LOGS', {
type: 'error', Vue.nextTick(() => {
message: err.message, store.commit('ADD_LOGS', {
stack: err.stack, type: 'error',
info message: err.message,
}) stack: err.stack,
if (process.env.NODE_ENV === 'development') { info
console.group('>>>>>> 错误信息 >>>>>>')
console.log(info)
console.groupEnd();
console.group('>>>>>> Vue 实例 >>>>>>')
console.log(vm)
console.groupEnd();
console.group('>>>>>> Error >>>>>>')
console.log(err)
console.groupEnd();
}
}) })
} if (process.env.NODE_ENV === 'development') {
\ No newline at end of file console.group('>>>>>> 错误信息 >>>>>>')
console.log(info)
console.groupEnd();
console.group('>>>>>> Vue 实例 >>>>>>')
console.log(vm)
console.groupEnd();
console.group('>>>>>> Error >>>>>>')
console.log(err)
console.groupEnd();
}
})
}
function pluralize(time, label) { function pluralize(time, label) {
if (time === 1) { if (time === 1) {
return time + label return time + label
} }
return time + label + 's' return time + label + 's'
} }
/** /**
* 日期格式化 * 日期格式化
*/ */
export function dateFormat(date) { export function dateFormat(date) {
let format = 'yyyy-MM-dd hh:mm:ss'; let format = 'yyyy-MM-dd hh:mm:ss';
if (date != 'Invalid Date') { if (date != 'Invalid Date') {
var o = { var o = {
"M+": date.getMonth() + 1, //month "M+": date.getMonth() + 1, //month
"d+": date.getDate(), //day "d+": date.getDate(), //day
"h+": date.getHours(), //hour "h+": date.getHours(), //hour
"m+": date.getMinutes(), //minute "m+": date.getMinutes(), //minute
"s+": date.getSeconds(), //second "s+": date.getSeconds(), //second
"q+": Math.floor((date.getMonth() + 3) / 3), //quarter "q+": Math.floor((date.getMonth() + 3) / 3), //quarter
"S": date.getMilliseconds() //millisecond "S": date.getMilliseconds() //millisecond
}
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
(date.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length == 1 ? o[k] :
("00" + o[k]).substr(("" + o[k]).length));
return format;
} }
return ''; if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
(date.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length == 1 ? o[k] :
("00" + o[k]).substr(("" + o[k]).length));
return format;
}
return '';
} }
export function timeAgo(time) { export function timeAgo(time) {
const between = Date.now() / 1000 - Number(time) const between = Date.now() / 1000 - Number(time)
if (between < 3600) { if (between < 3600) {
return pluralize(~~(between / 60), ' minute') return pluralize(~~(between / 60), ' minute')
} else if (between < 86400) { } else if (between < 86400) {
return pluralize(~~(between / 3600), ' hour') return pluralize(~~(between / 3600), ' hour')
} else { } else {
return pluralize(~~(between / 86400), ' day') return pluralize(~~(between / 86400), ' day')
} }
} }
export function parseTime(time, cFormat) { export function parseTime(time, cFormat) {
if (arguments.length === 0) { if (arguments.length === 0) {
return null return null
} }
if ((time + '').length === 10) { if ((time + '').length === 10) {
time = +time * 1000 time = +time * 1000
} }
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}' const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
let date let date
if (typeof time === 'object') { if (typeof time === 'object') {
date = time date = time
} else { } else {
date = new Date(parseInt(time)) date = new Date(parseInt(time))
} }
const formatObj = { const formatObj = {
y: date.getFullYear(), y: date.getFullYear(),
m: date.getMonth() + 1, m: date.getMonth() + 1,
d: date.getDate(), d: date.getDate(),
h: date.getHours(), h: date.getHours(),
i: date.getMinutes(), i: date.getMinutes(),
s: date.getSeconds(), s: date.getSeconds(),
a: date.getDay() a: date.getDay()
}
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key]
if (key === 'a') return ['一', '二', '三', '四', '五', '六', '日'][value - 1]
if (result.length > 0 && value < 10) {
value = '0' + value
} }
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { return value || 0
let value = formatObj[key] })
if (key === 'a') return ['一', '二', '三', '四', '五', '六', '日'][value - 1] return time_str
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
return time_str
} }
export function formatTime(time, option) { export function formatTime(time, option) {
time = +time * 1000 time = +time * 1000
const d = new Date(time) const d = new Date(time)
const now = Date.now() const now = Date.now()
const diff = (now - d) / 1000 const diff = (now - d) / 1000
if (diff < 30) { if (diff < 30) {
return '刚刚' return '刚刚'
} else if (diff < 3600) { // less 1 hour } else if (diff < 3600) { // less 1 hour
return Math.ceil(diff / 60) + '分钟前' return Math.ceil(diff / 60) + '分钟前'
} else if (diff < 3600 * 24) { } else if (diff < 3600 * 24) {
return Math.ceil(diff / 3600) + '小时前' return Math.ceil(diff / 3600) + '小时前'
} else if (diff < 3600 * 24 * 2) { } else if (diff < 3600 * 24 * 2) {
return '1天前' return '1天前'
} }
if (option) { if (option) {
return parseTime(time, option) return parseTime(time, option)
} else { } else {
return d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分' return d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分'
} }
} }
/* 数字 格式化*/ /* 数字 格式化*/
export function nFormatter(num, digits) { export function nFormatter(num, digits) {
const si = [ const si = [
{ value: 1E18, symbol: 'E' }, {value: 1E18, symbol: 'E'},
{ value: 1E15, symbol: 'P' }, {value: 1E15, symbol: 'P'},
{ value: 1E12, symbol: 'T' }, {value: 1E12, symbol: 'T'},
{ value: 1E9, symbol: 'G' }, {value: 1E9, symbol: 'G'},
{ value: 1E6, symbol: 'M' }, {value: 1E6, symbol: 'M'},
{ value: 1E3, symbol: 'k' } {value: 1E3, symbol: 'k'}
] ]
for (let i = 0; i < si.length; i++) { for (let i = 0; i < si.length; i++) {
if (num >= si[i].value) { if (num >= si[i].value) {
return (num / si[i].value + 0.1).toFixed(digits).replace(/\.0+$|(\.[0-9]*[1-9])0+$/, '$1') + si[i].symbol return (num / si[i].value + 0.1).toFixed(digits).replace(/\.0+$|(\.[0-9]*[1-9])0+$/, '$1') + si[i].symbol
}
} }
return num.toString() }
return num.toString()
} }
export function html2Text(val) { export function html2Text(val) {
const div = document.createElement('div') const div = document.createElement('div')
div.innerHTML = val div.innerHTML = val
return div.textContent || div.innerText return div.textContent || div.innerText
} }
export function toThousandslsFilter(num) { export function toThousandslsFilter(num) {
return (+num || 0).toString().replace(/^-?\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ',')) return (+num || 0).toString().replace(/^-?\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ','))
} }
\ No newline at end of file
...@@ -10,32 +10,26 @@ import router from './router/router'; ...@@ -10,32 +10,26 @@ import router from './router/router';
import 'avue-plugin-transfer/packages' //引入avue-plugin-transfer插件 import 'avue-plugin-transfer/packages' //引入avue-plugin-transfer插件
// import 'avue-plugin-ueditor/packages' //引入avue-plugin-ueditor插件(如果要兼容ie自行换掉富文本编辑器,此款插件不兼容ie) // import 'avue-plugin-ueditor/packages' //引入avue-plugin-ueditor插件(如果要兼容ie自行换掉富文本编辑器,此款插件不兼容ie)
import store from './store'; import store from './store';
import { import {loadStyle} from './util/util'
loadStyle
} from './util/util'
import * as urls from '@/config/env'; import * as urls from '@/config/env';
import { import {iconfontUrl, iconfontVersion} from '@/config/env';
iconfontUrl,
iconfontVersion
} from '@/config/env';
import * as filters from './filters' // 全局filter import * as filters from './filters' // 全局filter
import './styles/common.scss'; import './styles/common.scss';
// // 引入avue的包 // // 引入avue的包
import Avue from '@smallwei/avue/lib/index.js'; import Avue from '@smallwei/avue/lib/index.js';
// // 引入avue的样式文件 // // 引入avue的样式文件
import '@smallwei/avue/lib/theme-chalk/index.css'; import '@smallwei/avue/lib/theme-chalk/index.css';
// //源文件包
// import '../packages/index.js';
// import '../packages/theme-chalk/src/index.scss';
import basicContainer from './components/basic-container/main' import basicContainer from './components/basic-container/main'
import VueClipboard from 'vue-clipboard2' import VueClipboard from 'vue-clipboard2'
// 插件 json 展示 // 插件 json 展示
import vueJsonTreeView from 'vue-json-tree-view' import vueJsonTreeView from 'vue-json-tree-view'
// //源文件包
// import '../packages/index.js';
// import '../packages/theme-chalk/src/index.scss';
Vue.use(Avue, { menuType : 'text'}); Vue.use(Avue, {menuType: 'text'});
Vue.use(router) Vue.use(router)
...@@ -48,21 +42,21 @@ Vue.use(VueAxios, axios) ...@@ -48,21 +42,21 @@ Vue.use(VueAxios, axios)
Vue.component('basicContainer', basicContainer) Vue.component('basicContainer', basicContainer)
Object.keys(urls).forEach(key => { Object.keys(urls).forEach(key => {
Vue.prototype[key] = urls[key]; Vue.prototype[key] = urls[key];
}) })
Object.keys(filters).forEach(key => { Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key]) Vue.filter(key, filters[key])
}) })
iconfontVersion.forEach(ele => { iconfontVersion.forEach(ele => {
loadStyle(iconfontUrl.replace('$key', ele)); loadStyle(iconfontUrl.replace('$key', ele));
}) })
Vue.config.productionTip = false; Vue.config.productionTip = false;
new Vue({ new Vue({
router, router,
store, store,
render: h => h(App) render: h => h(App)
}).$mount('#app') }).$mount('#app')
...@@ -22,84 +22,90 @@ ...@@ -22,84 +22,90 @@
</div> </div>
</template> </template>
<script> <script>
import { mapGetters, mapState } from "vuex"; import {mapGetters, mapState} from "vuex";
export default {
name: "lock", export default {
data () { name: "lock",
return { data() {
passwd: "", return {
passwdError: false, passwd: "",
pass: false passwdError: false,
}; pass: false
}, };
created () { }, },
mounted () { }, created() {
computed: { },
...mapState({ mounted() {
userInfo: state => state.user.userInfo
}),
...mapGetters(["tag", "lockPasswd"])
},
props: [],
methods: {
handleLogout () {
this.$confirm("是否退出系统, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$store.dispatch("LogOut").then(() => {
this.$router.push({ path: "/login" });
});
});
}, },
handleLogin () { computed: {
if (this.passwd != this.lockPasswd) { ...mapState({
this.passwd = ""; userInfo: state => state.user.userInfo
this.$message({ }),
message: "解锁密码错误,请重新输入", ...mapGetters(["tag", "lockPasswd"])
type: "error" },
props: [],
methods: {
handleLogout() {
this.$confirm("是否退出系统, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$store.dispatch("LogOut").then(() => {
this.$router.push({path: "/login"});
});
}); });
this.passwdError = true; },
handleLogin() {
if (this.passwd != this.lockPasswd) {
this.passwd = "";
this.$message({
message: "解锁密码错误,请重新输入",
type: "error"
});
this.passwdError = true;
setTimeout(() => {
this.passwdError = false;
}, 1000);
return;
}
this.pass = true;
setTimeout(() => { setTimeout(() => {
this.passwdError = false; this.$store.commit("CLEAR_LOCK");
this.$router.push({path: this.$router.$avueRouter.getPath({src: this.tag.value})});
}, 1000); }, 1000);
return;
} }
this.pass = true; },
setTimeout(() => { components: {}
this.$store.commit("CLEAR_LOCK"); };
this.$router.push({ path: this.$router.$avueRouter.getPath({ src: this.tag.value }) });
}, 1000);
}
},
components: {}
};
</script> </script>
<style lang="scss"> <style lang="scss">
.lock-container { .lock-container {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: relative; position: relative;
.title {
margin-bottom: 8px; .title {
color: #333; margin-bottom: 8px;
color: #333;
}
}
.lock-container::before {
z-index: -999;
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-image: url('/img/login.png');
background-size: cover;
}
.lock-form {
width: 300px;
} }
} </style>
.lock-container::before {
z-index: -999;
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-image: url('/img/login.png');
background-size: cover;
}
.lock-form {
width: 300px;
}
</style>
\ No newline at end of file
...@@ -20,11 +20,10 @@ ...@@ -20,11 +20,10 @@
class="login-select animated fadeIn" class="login-select animated fadeIn"
v-model="active" v-model="active"
@change="handleCommand" @change="handleCommand"
placeholder="请选择租户,不选为默认" placeholder="点击请选择租户"
size="mini" size="mini">
> <el-option label="租户1 用户登录" value="1"></el-option>
<el-option label="租户1" value="1"></el-option> <el-option label="租户2 用户登录" value="2"></el-option>
<el-option label="租户2" value="2"></el-option>
</el-select> </el-select>
</h4> </h4>
<userLogin v-if="activeName==='user'"></userLogin> <userLogin v-if="activeName==='user'"></userLogin>
......
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
</el-row> </el-row>
</el-form-item> </el-form-item>
<el-checkbox v-model="checked">记住账号</el-checkbox>
<el-form-item> <el-form-item>
<el-button type="primary" <el-button type="primary"
size="small" size="small"
......
...@@ -57,78 +57,80 @@ ...@@ -57,78 +57,80 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import {mapGetters} from 'vuex';
export default {
name: 'wel', export default {
data() { name: 'wel',
return { data() {
activeNames: ['1', '2', '3', '4'], return {
DATA: [], activeNames: ['1', '2', '3', '4'],
text: '', DATA: [],
actor: '', text: '',
count: 0, actor: '',
isText: false count: 0,
isText: false
}
},
computed: {
...mapGetters(['website'])
},
methods: {
getData() {
if (this.count < this.DATA.length - 1) {
this.count++
} else {
this.count = 0
}
this.isText = true
this.actor = this.DATA[this.count]
},
setData() {
let num = 0
let count = 0
let active = false
let timeoutstart = 5000
let timeoutend = 1000
let timespeed = 10
setInterval(() => {
if (this.isText) {
if (count == this.actor.length) {
active = true
} else {
active = false
} }
}, if (active) {
computed: { num--
...mapGetters(['website']) this.text = this.actor.substr(0, num)
}, if (num == 0) {
methods: { this.isText = false
getData() { setTimeout(() => {
if (this.count < this.DATA.length - 1) { count = 0
this.count++ this.getData()
} else { }, timeoutend)
this.count = 0 }
} } else {
this.isText = true num++
this.actor = this.DATA[this.count] this.text = this.actor.substr(0, num)
}, if (num == this.actor.length) {
setData() { this.isText = false
let num = 0 setTimeout(() => {
let count = 0 this.isText = true
let active = false count = this.actor.length
let timeoutstart = 5000 }, timeoutstart)
let timeoutend = 1000 }
let timespeed = 10
setInterval(() => {
if (this.isText) {
if (count == this.actor.length) {
active = true
} else {
active = false
}
if (active) {
num--
this.text = this.actor.substr(0, num)
if (num == 0) {
this.isText = false
setTimeout(() => {
count = 0
this.getData()
}, timeoutend)
}
} else {
num++
this.text = this.actor.substr(0, num)
if (num == this.actor.length) {
this.isText = false
setTimeout(() => {
this.isText = true
count = this.actor.length
}, timeoutstart)
}
}
}
}, timespeed)
} }
} }
}, timespeed)
}
} }
}
</script> </script>
<style scoped="scoped" lang="scss"> <style scoped="scoped" lang="scss">
.wel-contailer { .wel-contailer {
position: relative; position: relative;
} }
.banner-text { .banner-text {
position: relative; position: relative;
padding: 0 20px; padding: 0 20px;
...@@ -136,6 +138,7 @@ ...@@ -136,6 +138,7 @@
text-align: center; text-align: center;
color: #333; color: #333;
} }
.banner-img { .banner-img {
position: absolute; position: absolute;
top: 0; top: 0;
...@@ -145,6 +148,7 @@ ...@@ -145,6 +148,7 @@
opacity: 0.8; opacity: 0.8;
display: none; display: none;
} }
.actor { .actor {
height: 250px; height: 250px;
overflow: hidden; overflow: hidden;
......
/** /**
* 全站权限配置 * 全站权限配置
* *
*/ */
import router from './router/router' import router from './router/router'
import store from './store' import store from './store'
import { validatenull } from '@/util/validate' import {validatenull} from '@/util/validate'
import { getToken } from '@/util/auth' import {getToken} from '@/util/auth'
import NProgress from 'nprogress' // progress bar import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style import 'nprogress/nprogress.css' // progress bar style
NProgress.configure({ showSpinner: false }); NProgress.configure({showSpinner: false});
const lockPage = store.getters.website.lockPage; //锁屏页 const lockPage = store.getters.website.lockPage; //锁屏页
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
//缓冲设置 //缓冲设置
if (to.meta.keepAlive === true && store.state.tags.tagList.some(ele => { if (to.meta.keepAlive === true && store.state.tags.tagList.some(ele => {
return ele.value === to.fullPath; return ele.value === to.fullPath;
})) { })) {
to.meta.$keepAlive = true; to.meta.$keepAlive = true;
} else {
NProgress.start()
if (to.meta.keepAlive === true && validatenull(to.meta.$keepAlive)) {
to.meta.$keepAlive = true;
} else { } else {
NProgress.start() to.meta.$keepAlive = false;
if (to.meta.keepAlive === true && validatenull(to.meta.$keepAlive)) {
to.meta.$keepAlive = true;
} else {
to.meta.$keepAlive = false;
}
} }
const meta = to.meta || {}; }
if (getToken()) { const meta = to.meta || {};
if (store.getters.isLock && to.path != lockPage) { if (getToken()) {
next({ path: lockPage }) if (store.getters.isLock && to.path != lockPage) {
} else if (to.path === '/login') { next({path: lockPage})
next({ path: '/' }) } else if (to.path === '/login') {
} else { next({path: '/'})
if (store.getters.roles.length === 0) {
store.dispatch('GetUserInfo').then(() => {
next({...to, replace: true })
}).catch(() => {
store.dispatch('FedLogOut').then(() => {
next({ path: '/login' })
})
})
} else {
const value = to.query.src || to.fullPath;
const label = to.query.name || to.name;
if (meta.isTab !== false && !validatenull(value) && !validatenull(label)) {
store.commit('ADD_TAG', {
label: label,
value: value,
params: to.params,
query: to.query,
group: router.$avueRouter.group || []
});
}
next()
}
}
} else { } else {
if (meta.isAuth === false) { if (store.getters.roles.length === 0) {
next() store.dispatch('GetUserInfo').then(() => {
} else { next({...to, replace: true})
next('/login') }).catch(() => {
store.dispatch('FedLogOut').then(() => {
next({path: '/login'})
})
})
} else {
const value = to.query.src || to.fullPath;
const label = to.query.name || to.name;
if (meta.isTab !== false && !validatenull(value) && !validatenull(label)) {
store.commit('ADD_TAG', {
label: label,
value: value,
params: to.params,
query: to.query,
group: router.$avueRouter.group || []
});
} }
next()
}
}
} else {
if (meta.isAuth === false) {
next()
} else {
next('/login')
} }
}
}) })
router.afterEach(() => { router.afterEach(() => {
NProgress.done(); NProgress.done();
const title = store.getters.tag.label; const title = store.getters.tag.label;
router.$avueRouter.setTitle(title); router.$avueRouter.setTitle(title);
}); });
\ No newline at end of file
const getters = { const getters = {
tag: state => state.tags.tag, tag: state => state.tags.tag,
website: state => state.common.website, website: state => state.common.website,
userInfo: state => state.user.userInfo, userInfo: state => state.user.userInfo,
theme: state => state.common.theme, theme: state => state.common.theme,
themeName: state => state.common.themeName, themeName: state => state.common.themeName,
isShade: state => state.common.isShade, isShade: state => state.common.isShade,
isCollapse: state => state.common.isCollapse, isCollapse: state => state.common.isCollapse,
keyCollapse: (state, getters) => getters.screen > 1 ? getters.isCollapse : false, keyCollapse: (state, getters) => getters.screen > 1 ? getters.isCollapse : false,
screen: state => state.common.screen, screen: state => state.common.screen,
isLock: state => state.common.isLock, isLock: state => state.common.isLock,
isFullScren: state => state.common.isFullScren, isFullScren: state => state.common.isFullScren,
lockPasswd: state => state.common.lockPasswd, lockPasswd: state => state.common.lockPasswd,
tagList: state => state.tags.tagList, tagList: state => state.tags.tagList,
tagWel: state => state.tags.tagWel, tagWel: state => state.tags.tagWel,
access_token: state => state.user.access_token, access_token: state => state.user.access_token,
refresh_token: state => state.user.refresh_token, refresh_token: state => state.user.refresh_token,
roles: state => state.user.roles, roles: state => state.user.roles,
permissions: state => state.user.permissions, permissions: state => state.user.permissions,
menu: state => state.user.menu, menu: state => state.user.menu,
menuAll: state => state.user.menuAll, menuAll: state => state.user.menuAll,
logsList: state => state.logs.logsList, logsList: state => state.logs.logsList,
logsLen: state => state.logs.logsList.length || 0, logsLen: state => state.logs.logsList.length || 0,
logsFlag: (state, getters) => getters.logsLen === 0 logsFlag: (state, getters) => getters.logsLen === 0
} }
export default getters export default getters
\ No newline at end of file
...@@ -8,13 +8,13 @@ import getters from './getters' ...@@ -8,13 +8,13 @@ import getters from './getters'
Vue.use(Vuex) Vue.use(Vuex)
const store = new Vuex.Store({ const store = new Vuex.Store({
modules: { modules: {
user, user,
common, common,
logs, logs,
tags tags
}, },
getters, getters,
}) })
export default store export default store
\ No newline at end of file
import { import {getStore, removeStore, setStore} from '@/util/store'
setStore,
getStore,
removeStore
} from '@/util/store'
import website from '@/const/website' import website from '@/const/website'
const common = {
state: { const common = {
isCollapse: false,
isFullScren: false,
isShade: false,
screen: -1,
isLock: getStore({ name: 'isLock' }) || false,
showTag: getStore({ name: 'showTag' }),
showDebug: getStore({ name: 'showDebug' }),
showCollapse: getStore({ name: 'showCollapse' }),
showSearch: getStore({ name: 'showSearch' }),
showLock: getStore({ name: 'showLock' }),
showFullScren: getStore({ name: 'showFullScren' }),
showTheme: getStore({ name: 'showTheme' }),
showColor: getStore({ name: 'showColor' }),
showMenu: getStore({ name: 'showMenu' }),
theme: getStore({ name: 'theme' }) || '#409EFF',
themeName: getStore({ name: 'themeName' }) || '',
lockPasswd: getStore({ name: 'lockPasswd' }) || '',
website: website,
},
actions: {
state: {
isCollapse: false,
isFullScren: false,
isShade: false,
screen: -1,
isLock: getStore({name: 'isLock'}) || false,
showTag: getStore({name: 'showTag'}),
showDebug: getStore({name: 'showDebug'}),
showCollapse: getStore({name: 'showCollapse'}),
showSearch: getStore({name: 'showSearch'}),
showLock: getStore({name: 'showLock'}),
showFullScren: getStore({name: 'showFullScren'}),
showTheme: getStore({name: 'showTheme'}),
showColor: getStore({name: 'showColor'}),
showMenu: getStore({name: 'showMenu'}),
theme: getStore({name: 'theme'}) || '#409EFF',
themeName: getStore({name: 'themeName'}) || '',
lockPasswd: getStore({name: 'lockPasswd'}) || '',
website: website,
},
actions: {},
mutations: {
SET_SHADE: (state, active) => {
state.isShade = active;
},
SET_COLLAPSE: (state) => {
state.isCollapse = !state.isCollapse;
},
SET_FULLSCREN: (state) => {
state.isFullScren = !state.isFullScren;
},
SET_SHOWCOLLAPSE: (state, active) => {
state.showCollapse = active;
setStore({
name: 'showCollapse',
content: state.showCollapse
})
},
SET_SHOWTAG: (state, active) => {
state.showTag = active;
setStore({
name: 'showTag',
content: state.showTag
})
},
SET_SHOWMENU: (state, active) => {
state.showMenu = active;
setStore({
name: 'showMenu',
content: state.showMenu
})
},
SET_SHOWLOCK: (state, active) => {
state.showLock = active;
setStore({
name: 'showLock',
content: state.showLock
})
},
SET_SHOWSEARCH: (state, active) => {
state.showSearch = active;
setStore({
name: 'showSearch',
content: state.showSearch
})
},
SET_SHOWFULLSCREN: (state, active) => {
state.showFullScren = active;
setStore({
name: 'showFullScren',
content: state.showFullScren
})
},
SET_SHOWDEBUG: (state, active) => {
state.showDebug = active;
setStore({
name: 'showDebug',
content: state.showDebug
})
},
SET_SHOWTHEME: (state, active) => {
state.showTheme = active;
setStore({
name: 'showTheme',
content: state.showTheme
})
},
SET_SHOWCOLOR: (state, active) => {
state.showColor = active;
setStore({
name: 'showColor',
content: state.showColor
})
},
SET_LOCK: (state) => {
state.isLock = true;
setStore({
name: 'isLock',
content: state.isLock,
type: 'session'
})
},
SET_SCREEN: (state, screen) => {
state.screen = screen;
},
SET_THEME: (state, color) => {
state.theme = color;
setStore({
name: 'theme',
content: state.theme,
})
},
SET_THEME_NAME: (state, themeName) => {
state.themeName = themeName;
setStore({
name: 'themeName',
content: state.themeName,
})
},
SET_LOCK_PASSWD: (state, lockPasswd) => {
state.lockPasswd = lockPasswd;
setStore({
name: 'lockPasswd',
content: state.lockPasswd,
type: 'session'
})
},
CLEAR_LOCK: (state) => {
state.isLock = false;
state.lockPasswd = '';
removeStore({
name: 'lockPasswd'
});
removeStore({
name: 'isLock'
});
}, },
mutations: { }
SET_SHADE: (state, active) => {
state.isShade = active;
},
SET_COLLAPSE: (state) => {
state.isCollapse = !state.isCollapse;
},
SET_FULLSCREN: (state) => {
state.isFullScren = !state.isFullScren;
},
SET_SHOWCOLLAPSE: (state, active) => {
state.showCollapse = active;
setStore({
name: 'showCollapse',
content: state.showCollapse
})
},
SET_SHOWTAG: (state, active) => {
state.showTag = active;
setStore({
name: 'showTag',
content: state.showTag
})
},
SET_SHOWMENU: (state, active) => {
state.showMenu = active;
setStore({
name: 'showMenu',
content: state.showMenu
})
},
SET_SHOWLOCK: (state, active) => {
state.showLock = active;
setStore({
name: 'showLock',
content: state.showLock
})
},
SET_SHOWSEARCH: (state, active) => {
state.showSearch = active;
setStore({
name: 'showSearch',
content: state.showSearch
})
},
SET_SHOWFULLSCREN: (state, active) => {
state.showFullScren = active;
setStore({
name: 'showFullScren',
content: state.showFullScren
})
},
SET_SHOWDEBUG: (state, active) => {
state.showDebug = active;
setStore({
name: 'showDebug',
content: state.showDebug
})
},
SET_SHOWTHEME: (state, active) => {
state.showTheme = active;
setStore({
name: 'showTheme',
content: state.showTheme
})
},
SET_SHOWCOLOR: (state, active) => {
state.showColor = active;
setStore({
name: 'showColor',
content: state.showColor
})
},
SET_LOCK: (state) => {
state.isLock = true;
setStore({
name: 'isLock',
content: state.isLock,
type: 'session'
})
},
SET_SCREEN: (state, screen) => {
state.screen = screen;
},
SET_THEME: (state, color) => {
state.theme = color;
setStore({
name: 'theme',
content: state.theme,
})
},
SET_THEME_NAME: (state, themeName) => {
state.themeName = themeName;
setStore({
name: 'themeName',
content: state.themeName,
})
},
SET_LOCK_PASSWD: (state, lockPasswd) => {
state.lockPasswd = lockPasswd;
setStore({
name: 'lockPasswd',
content: state.lockPasswd,
type: 'session'
})
},
CLEAR_LOCK: (state) => {
state.isLock = false;
state.lockPasswd = '';
removeStore({
name: 'lockPasswd'
});
removeStore({
name: 'isLock'
});
},
}
} }
export default common export default common
\ No newline at end of file
import { setStore, getStore } from '@/util/store' import {getStore, setStore} from '@/util/store'
import { dateFormat } from '@/filters/' import {dateFormat} from '@/filters/'
import { sendLogs } from '@/api/admin/log' import {sendLogs} from '@/api/admin/log'
const logs = { const logs = {
state: { state: {
logsList: getStore({ name: 'logsList' }) || [], logsList: getStore({name: 'logsList'}) || [],
},
actions: {
//发送错误日志
SendLogs({state, commit}) {
return new Promise((resolve, reject) => {
sendLogs(state.logsList).then(() => {
commit('CLEAR_LOGS');
resolve();
}).catch(error => {
reject(error)
})
})
}, },
actions: { },
//发送错误日志 mutations: {
SendLogs({ state, commit }) { ADD_LOGS: (state, {type, message, stack, info}) => {
return new Promise((resolve, reject) => { state.logsList.push(Object.assign({
sendLogs(state.logsList).then(() => { url: window.location.href,
commit('CLEAR_LOGS'); time: dateFormat(new Date())
resolve(); }, {
}).catch(error => { type,
reject(error) message,
}) stack,
}) info: info.toString()
}, }))
setStore({name: 'logsList', content: state.logsList})
}, },
mutations: { CLEAR_LOGS: (state) => {
ADD_LOGS: (state, { type, message, stack, info }) => { state.logsList = [];
state.logsList.push(Object.assign({ setStore({name: 'logsList', content: state.logsList})
url: window.location.href,
time: dateFormat(new Date())
}, {
type,
message,
stack,
info: info.toString()
}))
setStore({ name: 'logsList', content: state.logsList })
},
CLEAR_LOGS: (state) => {
state.logsList = [];
setStore({ name: 'logsList', content: state.logsList })
}
} }
}
}; };
......
import { setStore, getStore } from '@/util/store' import {getStore, setStore} from '@/util/store'
import { diff } from '@/util/util' import {diff} from '@/util/util'
import website from '@/const/website' import website from '@/const/website'
const isFirstPage = website.isFirstPage; const isFirstPage = website.isFirstPage;
const tagWel = website.fistPage; const tagWel = website.fistPage;
const tagObj = { const tagObj = {
label: '', //标题名称 label: '', //标题名称
value: '', //标题的路径 value: '', //标题的路径
params: '', //标题的路径参数 params: '', //标题的路径参数
query: '', //标题的参数 query: '', //标题的参数
group: [], //分组 group: [], //分组
} }
//处理首个标签
//处理首个标签
function setFistTag(list) { function setFistTag(list) {
if (list.length == 1) { if (list.length == 1) {
list[0].close = false; list[0].close = false;
} else { } else {
list.forEach(ele => { list.forEach(ele => {
if (ele.value === tagWel.value && isFirstPage === false) { if (ele.value === tagWel.value && isFirstPage === false) {
ele.close = false ele.close = false
} else { } else {
ele.close = true ele.close = true
} }
}) })
} }
} }
const navs = { const navs = {
state: { state: {
tagList: getStore({ name: 'tagList' }) || [], tagList: getStore({name: 'tagList'}) || [],
tag: getStore({ name: 'tag' }) || tagObj, tag: getStore({name: 'tag'}) || tagObj,
tagWel: tagWel tagWel: tagWel
},
actions: {},
mutations: {
ADD_TAG: (state, action) => {
state.tag = action;
setStore({name: 'tag', content: state.tag, type: 'session'})
if (state.tagList.some(ele => diff(ele, action))) return
state.tagList.push(action)
setFistTag(state.tagList);
setStore({name: 'tagList', content: state.tagList, type: 'session'})
}, },
actions: { DEL_TAG: (state, action) => {
state.tagList = state.tagList.filter(item => {
return !diff(item, action);
})
setFistTag(state.tagList);
setStore({name: 'tagList', content: state.tagList, type: 'session'})
},
DEL_ALL_TAG: (state) => {
state.tagList = [state.tagWel];
setStore({name: 'tagList', content: state.tagList, type: 'session'})
},
DEL_TAG_OTHER: (state) => {
state.tagList = state.tagList.filter(item => item.value === state.tag.value)
setFistTag(state.tagList);
setStore({name: 'tagList', content: state.tagList, type: 'session'})
}, },
mutations: { }
ADD_TAG: (state, action) => {
state.tag = action;
setStore({ name: 'tag', content: state.tag, type: 'session' })
if (state.tagList.some(ele => diff(ele, action))) return
state.tagList.push(action)
setFistTag(state.tagList);
setStore({ name: 'tagList', content: state.tagList, type: 'session' })
},
DEL_TAG: (state, action) => {
state.tagList = state.tagList.filter(item => {
return !diff(item, action);
})
setFistTag(state.tagList);
setStore({ name: 'tagList', content: state.tagList, type: 'session' })
},
DEL_ALL_TAG: (state) => {
state.tagList = [state.tagWel];
setStore({ name: 'tagList', content: state.tagList, type: 'session' })
},
DEL_TAG_OTHER: (state) => {
state.tagList = state.tagList.filter(item => item.value === state.tag.value)
setFistTag(state.tagList);
setStore({ name: 'tagList', content: state.tagList, type: 'session' })
},
}
} }
export default navs export default navs
\ No newline at end of file
import { setToken, removeToken } from '@/util/auth' import {removeToken, setToken} from '@/util/auth'
import { setStore, getStore } from '@/util/store' import {getStore, setStore} from '@/util/store'
import { isURL } from '@/util/validate' import {isURL} from '@/util/validate'
import { logout, loginByUsername, loginByMobile, loginBySocial, getUserInfo } from '@/api/login' import {getUserInfo, loginByMobile, loginBySocial, loginByUsername, logout} from '@/api/login'
import { encryption, deepClone } from '@/util/util' import {deepClone, encryption} from '@/util/util'
import webiste from '@/const/website'; import webiste from '@/const/website';
import { GetMenu } from '@/api/admin/menu' import {GetMenu} from '@/api/admin/menu'
function addPath(ele, first) { function addPath(ele, first) {
const propsConfig = webiste.menu.props; const propsConfig = webiste.menu.props;
const propsDefault = { const propsDefault = {
label: propsConfig.label || 'label', label: propsConfig.label || 'label',
path: propsConfig.path || 'path', path: propsConfig.path || 'path',
icon: propsConfig.icon || 'icon', icon: propsConfig.icon || 'icon',
children: propsConfig.children || 'children' children: propsConfig.children || 'children'
}
const isChild = ele[propsDefault.children] && ele[propsDefault.children].length !== 0;
if (!isChild && first) {
ele[propsDefault.path] = ele[propsDefault.path] + '/index'
return
}
ele[propsDefault.children].forEach(child => {
if (!isURL(child[propsDefault.path])) {
child[propsDefault.path] = `${ele[propsDefault.path]}/${child[propsDefault.path] ? child[propsDefault.path] : 'index'}`
} }
const isChild = ele[propsDefault.children] && ele[propsDefault.children].length !== 0; addPath(child);
if (!isChild && first) { })
ele[propsDefault.path] = ele[propsDefault.path] + '/index'
return
}
ele[propsDefault.children].forEach(child => {
if (!isURL(child[propsDefault.path])) {
child[propsDefault.path] = `${ele[propsDefault.path]}/${child[propsDefault.path]?child[propsDefault.path]:'index'}`
}
addPath(child);
})
} }
const user = { const user = {
state: { state: {
userInfo: {}, userInfo: {},
permissions: {}, permissions: {},
roles: [], roles: [],
menu: getStore({ menu: getStore({
name: 'menu' name: 'menu'
}) || [], }) || [],
menuAll: [], menuAll: [],
access_token: getStore({ access_token: getStore({
name: 'access_token' name: 'access_token'
}) || '', }) || '',
refresh_token: getStore({ refresh_token: getStore({
name: 'refresh_token' name: 'refresh_token'
}) || '' }) || ''
},
actions: {
//根据用户名登录
LoginByUsername({commit}, userInfo) {
const user = encryption({
data: userInfo,
key: 'pigxpigxpigxpigx',
param: ['password']
})
return new Promise((resolve, reject) => {
loginByUsername(user.username, user.password, user.code, user.randomStr).then(response => {
const data = response.data
setToken(data.access_token)
commit('SET_ACCESS_TOKEN', data.access_token)
commit('SET_REFRESH_TOKEN', data.refresh_token)
commit('CLEAR_LOCK')
resolve()
}).catch(error => {
reject(error)
})
})
},
//根据手机号登录
LoginByPhone({commit}, userInfo) {
return new Promise((resolve, reject) => {
loginByMobile(userInfo.mobile, userInfo.code).then(response => {
const data = response.data
setToken(data.access_token)
commit('SET_ACCESS_TOKEN', data.access_token)
commit('SET_REFRESH_TOKEN', data.refresh_token)
commit('CLEAR_LOCK')
resolve()
}).catch(error => {
reject(error)
})
})
},
// 根据OpenId登录
LoginBySocial({commit}, param) {
return new Promise((resolve, reject) => {
loginBySocial(param.state, param.code).then(response => {
const data = response.data
setToken(data.access_token)
commit('SET_ACCESS_TOKEN', data.access_token)
commit('SET_REFRESH_TOKEN', data.refresh_token)
commit('CLEAR_LOCK')
resolve()
}).catch(error => {
reject(error)
})
})
},
GetUserInfo({commit}) {
return new Promise((resolve, reject) => {
getUserInfo().then((res) => {
const data = res.data.data || {};
commit('SET_USERIFNO', data.sysUser);
commit('SET_ROLES', data.roles || []);
commit('SET_PERMISSIONS', data.permissions || [])
resolve(data);
}).catch((err) => {
reject();
})
})
},
//刷新token
RefeshToken({commit}) {
return new Promise((resolve, reject) => {
logout().then(() => {
commit('SET_TOKEN', new Date().getTime());
setToken();
resolve();
}).catch(error => {
reject(error)
})
})
},
// 登出
LogOut({commit}) {
return new Promise((resolve, reject) => {
logout().then(() => {
commit('SET_MENU', [])
commit('SET_PERMISSIONS', [])
commit('SET_USER_INFO', {})
commit('SET_ACCESS_TOKEN', '')
commit('SET_REFRESH_TOKEN', '')
commit('SET_ROLES', [])
commit('DEL_ALL_TAG')
commit('CLEAR_LOCK');
removeToken()
resolve()
}).catch(error => {
reject(error)
})
})
}, },
actions: { //注销session
//根据用户名登录 FedLogOut({commit}) {
LoginByUsername({ commit }, userInfo) { return new Promise(resolve => {
const user = encryption({ commit('SET_MENU', [])
data: userInfo, commit('SET_PERMISSIONS', [])
key: 'pigxpigxpigxpigx', commit('SET_USER_INFO', {})
param: ['password'] commit('SET_ACCESS_TOKEN', '')
}) commit('SET_REFRESH_TOKEN', '')
return new Promise((resolve, reject) => { commit('SET_ROLES', [])
loginByUsername(user.username, user.password, user.code, user.randomStr).then(response => { commit('DEL_ALL_TAG')
const data = response.data commit('CLEAR_LOCK');
setToken(data.access_token) removeToken()
commit('SET_ACCESS_TOKEN', data.access_token) resolve()
commit('SET_REFRESH_TOKEN', data.refresh_token) })
commit('CLEAR_LOCK') },
resolve() //获取系统菜单
}).catch(error => { GetMenu({
reject(error) commit
}) }) {
}) return new Promise(resolve => {
}, GetMenu().then((res) => {
//根据手机号登录 const data = res.data.data
LoginByPhone({ commit }, userInfo) { let menu = deepClone(data);
return new Promise((resolve, reject) => { menu.forEach(ele => {
loginByMobile(userInfo.mobile, userInfo.code).then(response => { addPath(ele);
const data = response.data })
setToken(data.access_token) commit('SET_MENU', menu)
commit('SET_ACCESS_TOKEN', data.access_token) resolve(menu)
commit('SET_REFRESH_TOKEN', data.refresh_token) })
commit('CLEAR_LOCK') })
resolve() }
}).catch(error => {
reject(error)
})
})
},
// 根据OpenId登录
LoginBySocial({ commit }, param) {
return new Promise((resolve, reject) => {
loginBySocial(param.state, param.code).then(response => {
const data = response.data
setToken(data.access_token)
commit('SET_ACCESS_TOKEN', data.access_token)
commit('SET_REFRESH_TOKEN', data.refresh_token)
commit('CLEAR_LOCK')
resolve()
}).catch(error => {
reject(error)
})
})
},
GetUserInfo({ commit }) {
return new Promise((resolve, reject) => {
getUserInfo().then((res) => {
const data = res.data.data || {};
commit('SET_USERIFNO', data.sysUser);
commit('SET_ROLES', data.roles || []);
commit('SET_PERMISSIONS', data.permissions || [])
resolve(data);
}).catch((err) => {
reject();
})
})
},
//刷新token
RefeshToken({ commit }) {
return new Promise((resolve, reject) => {
logout().then(() => {
commit('SET_TOKEN', new Date().getTime());
setToken();
resolve();
}).catch(error => {
reject(error)
})
})
},
// 登出
LogOut({ commit }) {
return new Promise((resolve, reject) => {
logout().then(() => {
commit('SET_MENU', [])
commit('SET_PERMISSIONS', [])
commit('SET_USER_INFO', {})
commit('SET_ACCESS_TOKEN', '')
commit('SET_REFRESH_TOKEN', '')
commit('SET_ROLES', [])
commit('DEL_ALL_TAG')
commit('CLEAR_LOCK');
removeToken()
resolve()
}).catch(error => {
reject(error)
})
})
},
//注销session
FedLogOut({ commit }) {
return new Promise(resolve => {
commit('SET_MENU', [])
commit('SET_PERMISSIONS', [])
commit('SET_USER_INFO', {})
commit('SET_ACCESS_TOKEN', '')
commit('SET_REFRESH_TOKEN', '')
commit('SET_ROLES', [])
commit('DEL_ALL_TAG')
commit('CLEAR_LOCK');
removeToken()
resolve()
})
},
//获取系统菜单
GetMenu({
commit
}) {
return new Promise(resolve => {
GetMenu().then((res) => {
const data = res.data.data
let menu = deepClone(data);
menu.forEach(ele => {
addPath(ele);
})
commit('SET_MENU', menu)
resolve(menu)
})
})
}
},
mutations: {
SET_ACCESS_TOKEN: (state, access_token) => {
state.access_token = access_token
setStore({
name: 'access_token',
content: state.access_token,
type: 'session'
})
},
SET_REFRESH_TOKEN: (state, rfToken) => {
state.refresh_token = rfToken
setStore({
name: 'refresh_token',
content: state.refresh_token,
type: 'session'
})
},
SET_USERIFNO: (state, userInfo) => {
state.userInfo = userInfo;
}, },
mutations: { SET_MENU: (state, menu) => {
SET_ACCESS_TOKEN: (state, access_token) => { state.menu = menu
state.access_token = access_token setStore({
setStore({ name: 'menu',
name: 'access_token', content: state.menu,
content: state.access_token, type: 'session'
type: 'session' })
})
},
SET_REFRESH_TOKEN: (state, rfToken) => {
state.refresh_token = rfToken
setStore({
name: 'refresh_token',
content: state.refresh_token,
type: 'session'
})
},
SET_USERIFNO: (state, userInfo) => {
state.userInfo = userInfo;
},
SET_MENU: (state, menu) => {
state.menu = menu
setStore({
name: 'menu',
content: state.menu,
type: 'session'
})
}, },
SET_MENU_ALL: (state, menuAll) => { SET_MENU_ALL: (state, menuAll) => {
state.menuAll = menuAll; state.menuAll = menuAll;
}, },
SET_ROLES: (state, roles) => { SET_ROLES: (state, roles) => {
state.roles = roles; state.roles = roles;
}, },
SET_PERMISSIONS: (state, permissions) => { SET_PERMISSIONS: (state, permissions) => {
const list = {} const list = {}
for (let i = 0; i < permissions.length; i++) { for (let i = 0; i < permissions.length; i++) {
list[permissions[i]] = true list[permissions[i]] = true
} }
state.permissions = list state.permissions = list
}
} }
}
} }
export default user export default user
export default { export default {
getScreen: function() { getScreen: function () {
var width = document.body.clientWidth; var width = document.body.clientWidth;
if (width >= 1200) { if (width >= 1200) {
return 3; //大屏幕 return 3; //大屏幕
} else if (width >= 992) { } else if (width >= 992) {
return 2; //中屏幕 return 2; //中屏幕
} else if (width >= 768) { } else if (width >= 768) {
return 1; //小屏幕 return 1; //小屏幕
} else { } else {
return 0; //超小屏幕 return 0; //超小屏幕
}
} }
} }
\ No newline at end of file }
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
const TokenKey = 'x-access-token' const TokenKey = 'x-access-token'
export function getToken() { export function getToken() {
return Cookies.get(TokenKey) return Cookies.get(TokenKey)
} }
export function setToken(token) { export function setToken(token) {
return Cookies.set(TokenKey, token) return Cookies.set(TokenKey, token)
} }
export function removeToken() { export function removeToken() {
return Cookies.remove(TokenKey) return Cookies.remove(TokenKey)
} }
\ No newline at end of file
export const calcDate = (date1, date2) => { export const calcDate = (date1, date2) => {
var date3 = date2 - date1; var date3 = date2 - date1;
var days = Math.floor(date3 / (24 * 3600 * 1000)) var days = Math.floor(date3 / (24 * 3600 * 1000))
var leave1 = date3 % (24 * 3600 * 1000) //计算天数后剩余的毫秒数 var leave1 = date3 % (24 * 3600 * 1000) //计算天数后剩余的毫秒数
var hours = Math.floor(leave1 / (3600 * 1000)) var hours = Math.floor(leave1 / (3600 * 1000))
var leave2 = leave1 % (3600 * 1000) //计算小时数后剩余的毫秒数 var leave2 = leave1 % (3600 * 1000) //计算小时数后剩余的毫秒数
var minutes = Math.floor(leave2 / (60 * 1000)) var minutes = Math.floor(leave2 / (60 * 1000))
var leave3 = leave2 % (60 * 1000) //计算分钟数后剩余的毫秒数 var leave3 = leave2 % (60 * 1000) //计算分钟数后剩余的毫秒数
var seconds = Math.round(date3 / 1000) var seconds = Math.round(date3 / 1000)
return { return {
leave1, leave1,
leave2, leave2,
leave3, leave3,
days: days, days: days,
hours: hours, hours: hours,
minutes: minutes, minutes: minutes,
seconds: seconds, seconds: seconds,
} }
} }
\ No newline at end of file
import { import {validatenull} from '@/util/validate';
validatenull
} from '@/util/validate';
/** /**
* 存储localStorage * 存储localStorage
*/ */
export const setStore = (params) => { export const setStore = (params) => {
let { let {
name, name,
content, content,
type, type,
} = params; } = params;
let obj = { let obj = {
dataType: typeof(content), dataType: typeof (content),
content: content, content: content,
type: type, type: type,
datetime: new Date().getTime() datetime: new Date().getTime()
} }
if (type) window.sessionStorage.setItem(name, JSON.stringify(obj)); if (type) window.sessionStorage.setItem(name, JSON.stringify(obj));
else window.localStorage.setItem(name, JSON.stringify(obj)); else window.localStorage.setItem(name, JSON.stringify(obj));
} }
/** /**
* 获取localStorage * 获取localStorage
*/ */
export const getStore = (params) => { export const getStore = (params) => {
let { let {
name, name,
debug debug
} = params; } = params;
let obj = {}, let obj = {},
content; content;
obj = window.sessionStorage.getItem(name); obj = window.sessionStorage.getItem(name);
if (validatenull(obj)) obj = window.localStorage.getItem(name); if (validatenull(obj)) obj = window.localStorage.getItem(name);
if (validatenull(obj)) return; if (validatenull(obj)) return;
obj = JSON.parse(obj); obj = JSON.parse(obj);
if (debug) { if (debug) {
return obj; return obj;
} }
if (obj.dataType == 'string') { if (obj.dataType == 'string') {
content = obj.content; content = obj.content;
} else if (obj.dataType == 'number') { } else if (obj.dataType == 'number') {
content = Number(obj.content); content = Number(obj.content);
} else if (obj.dataType == 'boolean') { } else if (obj.dataType == 'boolean') {
content = eval(obj.content); content = eval(obj.content);
} else if (obj.dataType == 'object') { } else if (obj.dataType == 'object') {
content = obj.content; content = obj.content;
} }
return content; return content;
} }
/** /**
* 删除localStorage * 删除localStorage
*/ */
export const removeStore = params => { export const removeStore = params => {
let { let {
name name
} = params; } = params;
window.localStorage.removeItem(name); window.localStorage.removeItem(name);
window.sessionStorage.removeItem(name); window.sessionStorage.removeItem(name);
} }
/** /**
* 获取全部localStorage * 获取全部localStorage
*/ */
export const getAllStore = (params) => { export const getAllStore = (params) => {
let list = []; let list = [];
let { let {
type type
} = params; } = params;
for (let i = 1; i <= window.sessionStorage.length; i++) { for (let i = 1; i <= window.sessionStorage.length; i++) {
if (type) { if (type) {
list.push({ list.push({
name: window.sessionStorage.key(i), name: window.sessionStorage.key(i),
content: getStore({ content: getStore({
name: window.sessionStorage.key(i), name: window.sessionStorage.key(i),
type: 'session' type: 'session'
}) })
}) })
} else { } else {
list.push(getStore({ list.push(getStore({
name: window.localStorage.key(i), name: window.localStorage.key(i),
content: getStore({ content: getStore({
name: window.localStorage.key(i), name: window.localStorage.key(i),
}) })
})) }))
}
} }
}
return list; return list;
} }
...@@ -94,12 +93,12 @@ export const getAllStore = (params) => { ...@@ -94,12 +93,12 @@ export const getAllStore = (params) => {
* 清空全部localStorage * 清空全部localStorage
*/ */
export const clearStore = (params) => { export const clearStore = (params) => {
let { let {
type type
} = params; } = params;
if (type) { if (type) {
window.sessionStorage.clear(); window.sessionStorage.clear();
return return
} }
window.localStorage.clear() window.localStorage.clear()
} }
\ No newline at end of file
import { validatenull } from './validate' import {validatenull} from './validate'
//表单序列化 //表单序列化
export const serialize = data => { export const serialize = data => {
let list = []; let list = [];
Object.keys(data).forEach(ele => { Object.keys(data).forEach(ele => {
list.push(`${ele}=${data[ele]}`) list.push(`${ele}=${data[ele]}`)
}) })
return list.join('&'); return list.join('&');
}; };
export const getObjType = obj => { export const getObjType = obj => {
var toString = Object.prototype.toString; var toString = Object.prototype.toString;
var map = { var map = {
'[object Boolean]': 'boolean', '[object Boolean]': 'boolean',
'[object Number]': 'number', '[object Number]': 'number',
'[object String]': 'string', '[object String]': 'string',
'[object Function]': 'function', '[object Function]': 'function',
'[object Array]': 'array', '[object Array]': 'array',
'[object Date]': 'date', '[object Date]': 'date',
'[object RegExp]': 'regExp', '[object RegExp]': 'regExp',
'[object Undefined]': 'undefined', '[object Undefined]': 'undefined',
'[object Null]': 'null', '[object Null]': 'null',
'[object Object]': 'object' '[object Object]': 'object'
}; };
if (obj instanceof Element) { if (obj instanceof Element) {
return 'element'; return 'element';
} }
return map[toString.call(obj)]; return map[toString.call(obj)];
}; };
/** /**
* 对象深拷贝 * 对象深拷贝
*/ */
export const deepClone = data => { export const deepClone = data => {
var type = getObjType(data); var type = getObjType(data);
var obj; var obj;
if (type === 'array') { if (type === 'array') {
obj = []; obj = [];
} else if (type === 'object') { } else if (type === 'object') {
obj = {}; obj = {};
} else { } else {
//不再具有下一层次 //不再具有下一层次
return data; return data;
}
if (type === 'array') {
for (var i = 0, len = data.length; i < len; i++) {
obj.push(deepClone(data[i]));
} }
if (type === 'array') { } else if (type === 'object') {
for (var i = 0, len = data.length; i < len; i++) { for (var key in data) {
obj.push(deepClone(data[i])); obj[key] = deepClone(data[key]);
}
} else if (type === 'object') {
for (var key in data) {
obj[key] = deepClone(data[key]);
}
} }
return obj; }
return obj;
}; };
/** /**
* 判断路由是否相等 * 判断路由是否相等
*/ */
export const diff = (obj1, obj2) => { export const diff = (obj1, obj2) => {
delete obj1.close; delete obj1.close;
var o1 = obj1 instanceof Object; var o1 = obj1 instanceof Object;
var o2 = obj2 instanceof Object; var o2 = obj2 instanceof Object;
if (!o1 || !o2) { /* 判断不是对象 */ if (!o1 || !o2) { /* 判断不是对象 */
return obj1 === obj2; return obj1 === obj2;
} }
if (Object.keys(obj1).length !== Object.keys(obj2).length) { if (Object.keys(obj1).length !== Object.keys(obj2).length) {
return false; return false;
//Object.keys() 返回一个由对象的自身可枚举属性(key值)组成的数组,例如:数组返回下表:let arr = ["a", "b", "c"];console.log(Object.keys(arr))->0,1,2; //Object.keys() 返回一个由对象的自身可枚举属性(key值)组成的数组,例如:数组返回下表:let arr = ["a", "b", "c"];console.log(Object.keys(arr))->0,1,2;
} }
for (var attr in obj1) { for (var attr in obj1) {
var t1 = obj1[attr] instanceof Object; var t1 = obj1[attr] instanceof Object;
var t2 = obj2[attr] instanceof Object; var t2 = obj2[attr] instanceof Object;
if (t1 && t2) { if (t1 && t2) {
return diff(obj1[attr], obj2[attr]); return diff(obj1[attr], obj2[attr]);
} else if (obj1[attr] !== obj2[attr]) { } else if (obj1[attr] !== obj2[attr]) {
return false; return false;
}
}
return true;
} }
/** }
* 设置灰度模式 return true;
*/ }
/**
* 设置灰度模式
*/
export const toggleGrayMode = (status) => { export const toggleGrayMode = (status) => {
if (status) { if (status) {
document.body.className = document.body.className + ' grayMode'; document.body.className = document.body.className + ' grayMode';
} else { } else {
document.body.className = document.body.className.replace(' grayMode', ''); document.body.className = document.body.className.replace(' grayMode', '');
} }
}; };
/** /**
* 设置主题 * 设置主题
*/ */
export const setTheme = (name) => { export const setTheme = (name) => {
document.body.className = name; document.body.className = name;
} }
/** /**
*加密处理 *加密处理
*/ */
export const encryption = (params) => { export const encryption = (params) => {
let { let {
data,
type,
param,
key
} = params
const result = JSON.parse(JSON.stringify(data))
if (type === 'Base64') {
param.forEach(ele => {
result[ele] = btoa(result[ele])
})
} else {
param.forEach(ele => {
var data = result[ele]
key = CryptoJS.enc.Latin1.parse(key)
var iv = key
// 加密
var encrypted = CryptoJS.AES.encrypt(
data, data,
type, key, {
param, iv: iv,
key mode: CryptoJS.mode.CBC,
} = params padding: CryptoJS.pad.ZeroPadding
const result = JSON.parse(JSON.stringify(data))
if (type === 'Base64') {
param.forEach(ele => {
result[ele] = btoa(result[ele])
})
} else {
param.forEach(ele => {
var data = result[ele]
key = CryptoJS.enc.Latin1.parse(key)
var iv = key
// 加密
var encrypted = CryptoJS.AES.encrypt(
data,
key, {
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.ZeroPadding
})
result[ele] = encrypted.toString()
}) })
} result[ele] = encrypted.toString()
return result })
}
return result
} }
...@@ -134,85 +134,86 @@ export const encryption = (params) => { ...@@ -134,85 +134,86 @@ export const encryption = (params) => {
* 浏览器判断是否全屏 * 浏览器判断是否全屏
*/ */
export const fullscreenToggel = () => { export const fullscreenToggel = () => {
if (fullscreenEnable()) { if (fullscreenEnable()) {
exitFullScreen(); exitFullScreen();
} else { } else {
reqFullScreen(); reqFullScreen();
} }
}; };
/** /**
* esc监听全屏 * esc监听全屏
*/ */
export const listenfullscreen = (callback) => { export const listenfullscreen = (callback) => {
function listen() { function listen() {
callback() callback()
} }
document.addEventListener("fullscreenchange", function() {
listen(); document.addEventListener("fullscreenchange", function () {
}); listen();
document.addEventListener("mozfullscreenchange", function() { });
listen(); document.addEventListener("mozfullscreenchange", function () {
}); listen();
document.addEventListener("webkitfullscreenchange", function() { });
listen(); document.addEventListener("webkitfullscreenchange", function () {
}); listen();
document.addEventListener("msfullscreenchange", function() { });
listen(); document.addEventListener("msfullscreenchange", function () {
}); listen();
});
}; };
/** /**
* 浏览器判断是否全屏 * 浏览器判断是否全屏
*/ */
export const fullscreenEnable = () => { export const fullscreenEnable = () => {
var isFullscreen = document.fullscreenEnabled || var isFullscreen = document.fullscreenEnabled ||
window.fullScreen || window.fullScreen ||
document.mozFullscreenEnabled || document.mozFullscreenEnabled ||
document.webkitIsFullScreen; document.webkitIsFullScreen;
return isFullscreen; return isFullscreen;
} }
/** /**
* 浏览器全屏 * 浏览器全屏
*/ */
export const reqFullScreen = () => { export const reqFullScreen = () => {
if (document.documentElement.requestFullScreen) { if (document.documentElement.requestFullScreen) {
document.documentElement.requestFullScreen(); document.documentElement.requestFullScreen();
} else if (document.documentElement.webkitRequestFullScreen) { } else if (document.documentElement.webkitRequestFullScreen) {
document.documentElement.webkitRequestFullScreen(); document.documentElement.webkitRequestFullScreen();
} else if (document.documentElement.mozRequestFullScreen) { } else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen(); document.documentElement.mozRequestFullScreen();
} }
}; };
/** /**
* 浏览器退出全屏 * 浏览器退出全屏
*/ */
export const exitFullScreen = () => { export const exitFullScreen = () => {
if (document.documentElement.requestFullScreen) { if (document.documentElement.requestFullScreen) {
document.exitFullScreen(); document.exitFullScreen();
} else if (document.documentElement.webkitRequestFullScreen) { } else if (document.documentElement.webkitRequestFullScreen) {
document.webkitCancelFullScreen(); document.webkitCancelFullScreen();
} else if (document.documentElement.mozRequestFullScreen) { } else if (document.documentElement.mozRequestFullScreen) {
document.mozCancelFullScreen(); document.mozCancelFullScreen();
} }
}; };
/** /**
* 递归寻找子类的父类 * 递归寻找子类的父类
*/ */
export const findParent = (menu, id) => { export const findParent = (menu, id) => {
for (let i = 0; i < menu.length; i++) { for (let i = 0; i < menu.length; i++) {
if (menu[i].children.length != 0) { if (menu[i].children.length != 0) {
for (let j = 0; j < menu[i].children.length; j++) { for (let j = 0; j < menu[i].children.length; j++) {
if (menu[i].children[j].id == id) { if (menu[i].children[j].id == id) {
return menu[i]; return menu[i];
} else { } else {
if (menu[i].children[j].children.length != 0) { if (menu[i].children[j].children.length != 0) {
return findParent(menu[i].children[j].children, id); return findParent(menu[i].children[j].children, id);
} }
}
}
} }
}
} }
}
}; };
/** /**
* 判断2个对象属性和值是否相等 * 判断2个对象属性和值是否相等
...@@ -223,91 +224,91 @@ export const findParent = (menu, id) => { ...@@ -223,91 +224,91 @@ export const findParent = (menu, id) => {
*/ */
export const loadStyle = url => { export const loadStyle = url => {
const link = document.createElement('link'); const link = document.createElement('link');
link.type = 'text/css'; link.type = 'text/css';
link.rel = 'stylesheet'; link.rel = 'stylesheet';
link.href = url; link.href = url;
const head = document.getElementsByTagName('head')[0]; const head = document.getElementsByTagName('head')[0];
head.appendChild(link); head.appendChild(link);
}; };
/** /**
* 判断路由是否相等 * 判断路由是否相等
*/ */
export const isObjectValueEqual = (a, b) => { export const isObjectValueEqual = (a, b) => {
let result = true; let result = true;
Object.keys(a).forEach(ele => { Object.keys(a).forEach(ele => {
const type = typeof(a[ele]); const type = typeof (a[ele]);
if (type === 'string' && a[ele] !== b[ele]) result = false; if (type === 'string' && a[ele] !== b[ele]) result = false;
else if (type === 'object' && JSON.stringify(a[ele]) !== JSON.stringify(b[ele])) result = false; else if (type === 'object' && JSON.stringify(a[ele]) !== JSON.stringify(b[ele])) result = false;
}) })
return result; return result;
} }
/** /**
* 根据字典的value显示label * 根据字典的value显示label
*/ */
export const findByvalue = (dic, value) => { export const findByvalue = (dic, value) => {
let result = ''; let result = '';
if (validatenull(dic)) return value; if (validatenull(dic)) return value;
if (typeof(value) == 'string' || typeof(value) == 'number' || typeof(value) == 'boolean') { if (typeof (value) == 'string' || typeof (value) == 'number' || typeof (value) == 'boolean') {
let index = 0; let index = 0;
index = findArray(dic, value); index = findArray(dic, value);
if (index != -1) { if (index != -1) {
result = dic[index].label; result = dic[index].label;
} else { } else {
result = value; result = value;
}
} else if (value instanceof Array) {
result = [];
let index = 0;
value.forEach(ele => {
index = findArray(dic, ele);
if (index != -1) {
result.push(dic[index].label);
} else {
result.push(value);
}
});
result = result.toString();
} }
return result; } else if (value instanceof Array) {
result = [];
let index = 0;
value.forEach(ele => {
index = findArray(dic, ele);
if (index != -1) {
result.push(dic[index].label);
} else {
result.push(value);
}
});
result = result.toString();
}
return result;
}; };
/** /**
* 根据字典的value查找对应的index * 根据字典的value查找对应的index
*/ */
export const findArray = (dic, value) => { export const findArray = (dic, value) => {
for (let i = 0; i < dic.length; i++) { for (let i = 0; i < dic.length; i++) {
if (dic[i].value == value) { if (dic[i].value == value) {
return i; return i;
}
} }
return -1; }
return -1;
}; };
/** /**
* 生成随机len位数字 * 生成随机len位数字
*/ */
export const randomLenNum = (len, date) => { export const randomLenNum = (len, date) => {
let random = ''; let random = '';
random = Math.ceil(Math.random() * 100000000000000).toString().substr(0, len ? len : 4); random = Math.ceil(Math.random() * 100000000000000).toString().substr(0, len ? len : 4);
if (date) random = random + Date.now(); if (date) random = random + Date.now();
return random; return random;
}; };
/** /**
* 打开小窗口 * 打开小窗口
*/ */
export const openWindow = (url, title, w, h) => { export const openWindow = (url, title, w, h) => {
// Fixes dual-screen position Most browsers Firefox // Fixes dual-screen position Most browsers Firefox
const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left
const dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top const dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top
const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width
const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height
const left = ((width / 2) - (w / 2)) + dualScreenLeft const left = ((width / 2) - (w / 2)) + dualScreenLeft
const top = ((height / 2) - (h / 2)) + dualScreenTop const top = ((height / 2) - (h / 2)) + dualScreenTop
const newWindow = window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left) const newWindow = window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left)
// Puts focus on the newWindow // Puts focus on the newWindow
if (window.focus) { if (window.focus) {
newWindow.focus() newWindow.focus()
} }
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @param {*} s * @param {*} s
*/ */
export function isEmail(s) { export function isEmail(s) {
return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(s) return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(s)
} }
/** /**
...@@ -11,7 +11,7 @@ export function isEmail(s) { ...@@ -11,7 +11,7 @@ export function isEmail(s) {
* @param {*} s * @param {*} s
*/ */
export function isMobile(s) { export function isMobile(s) {
return /^1[0-9]{10}$/.test(s) return /^1[0-9]{10}$/.test(s)
} }
/** /**
...@@ -19,7 +19,7 @@ export function isMobile(s) { ...@@ -19,7 +19,7 @@ export function isMobile(s) {
* @param {*} s * @param {*} s
*/ */
export function isPhone(s) { export function isPhone(s) {
return /^([0-9]{3,4}-)?[0-9]{7,8}$/.test(s) return /^([0-9]{3,4}-)?[0-9]{7,8}$/.test(s)
} }
/** /**
...@@ -27,223 +27,231 @@ export function isPhone(s) { ...@@ -27,223 +27,231 @@ export function isPhone(s) {
* @param {*} s * @param {*} s
*/ */
export function isURL(s) { export function isURL(s) {
return /^http[s]?:\/\/.*/.test(s) return /^http[s]?:\/\/.*/.test(s)
} }
export function isvalidUsername(str) { export function isvalidUsername(str) {
const valid_map = ['admin', 'editor'] const valid_map = ['admin', 'editor']
return valid_map.indexOf(str.trim()) >= 0 return valid_map.indexOf(str.trim()) >= 0
} }
/* 合法uri*/ /* 合法uri*/
export function validateURL(textval) { export function validateURL(textval) {
const urlregex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/ const urlregex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
return urlregex.test(textval) return urlregex.test(textval)
} }
/* 小写字母*/ /* 小写字母*/
export function validateLowerCase(str) { export function validateLowerCase(str) {
const reg = /^[a-z]+$/ const reg = /^[a-z]+$/
return reg.test(str) return reg.test(str)
} }
/* 大写字母*/ /* 大写字母*/
export function validateUpperCase(str) { export function validateUpperCase(str) {
const reg = /^[A-Z]+$/ const reg = /^[A-Z]+$/
return reg.test(str) return reg.test(str)
} }
/* 大小写字母*/ /* 大小写字母*/
export function validatAlphabets(str) { export function validatAlphabets(str) {
const reg = /^[A-Za-z]+$/ const reg = /^[A-Za-z]+$/
return reg.test(str) return reg.test(str)
} }
/*验证pad还是pc*/ /*验证pad还是pc*/
export const vaildatePc = function() { export const vaildatePc = function () {
const userAgentInfo = navigator.userAgent; const userAgentInfo = navigator.userAgent;
const Agents = ["Android", "iPhone", const Agents = ["Android", "iPhone",
"SymbianOS", "Windows Phone", "SymbianOS", "Windows Phone",
"iPad", "iPod" "iPad", "iPod"
]; ];
let flag = true; let flag = true;
for (var v = 0; v < Agents.length; v++) { for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) { if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false; flag = false;
break; break;
}
}
return flag;
} }
/** }
* validate email return flag;
* @param email }
* @returns {boolean}
*/ /**
* validate email
* @param email
* @returns {boolean}
*/
export function validateEmail(email) { export function validateEmail(email) {
const re = /^(([^<>()\\[\]\\.,;:\s@"]+(\.[^<>()\\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ const re = /^(([^<>()\\[\]\\.,;:\s@"]+(\.[^<>()\\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
return re.test(email) return re.test(email)
} }
/** /**
* 判断身份证号码 * 判断身份证号码
*/ */
export function cardid(code) { export function cardid(code) {
let list = []; let list = [];
let result = true; let result = true;
let msg = ''; let msg = '';
var city = { var city = {
11: "北京", 11: "北京",
12: "天津", 12: "天津",
13: "河北", 13: "河北",
14: "山西", 14: "山西",
15: "内蒙古", 15: "内蒙古",
21: "辽宁", 21: "辽宁",
22: "吉林", 22: "吉林",
23: "黑龙江 ", 23: "黑龙江 ",
31: "上海", 31: "上海",
32: "江苏", 32: "江苏",
33: "浙江", 33: "浙江",
34: "安徽", 34: "安徽",
35: "福建", 35: "福建",
36: "江西", 36: "江西",
37: "山东", 37: "山东",
41: "河南", 41: "河南",
42: "湖北 ", 42: "湖北 ",
43: "湖南", 43: "湖南",
44: "广东", 44: "广东",
45: "广西", 45: "广西",
46: "海南", 46: "海南",
50: "重庆", 50: "重庆",
51: "四川", 51: "四川",
52: "贵州", 52: "贵州",
53: "云南", 53: "云南",
54: "西藏 ", 54: "西藏 ",
61: "陕西", 61: "陕西",
62: "甘肃", 62: "甘肃",
63: "青海", 63: "青海",
64: "宁夏", 64: "宁夏",
65: "新疆", 65: "新疆",
71: "台湾", 71: "台湾",
81: "香港", 81: "香港",
82: "澳门", 82: "澳门",
91: "国外 " 91: "国外 "
}; };
if (!validatenull(code)) { if (!validatenull(code)) {
if (code.length == 18) { if (code.length == 18) {
if (!code || !/(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(code)) { if (!code || !/(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(code)) {
msg = "证件号码格式错误"; msg = "证件号码格式错误";
} else if (!city[code.substr(0, 2)]) { } else if (!city[code.substr(0, 2)]) {
msg = "地址编码错误"; msg = "地址编码错误";
} else { } else {
//18位身份证需要验证最后一位校验位 //18位身份证需要验证最后一位校验位
code = code.split(''); code = code.split('');
//∑(ai×Wi)(mod 11) //∑(ai×Wi)(mod 11)
//加权因子 //加权因子
var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
//校验位 //校验位
var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2, 'x']; var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2, 'x'];
var sum = 0; var sum = 0;
var ai = 0; var ai = 0;
var wi = 0; var wi = 0;
for (var i = 0; i < 17; i++) { for (var i = 0; i < 17; i++) {
ai = code[i]; ai = code[i];
wi = factor[i]; wi = factor[i];
sum += ai * wi; sum += ai * wi;
} }
if (parity[sum % 11] != code[17]) { if (parity[sum % 11] != code[17]) {
msg = "证件号码校验位错误"; msg = "证件号码校验位错误";
} else {
result = false;
}
}
} else { } else {
msg = "证件号码长度不为18位"; result = false;
} }
}
} else { } else {
msg = "证件号码不能为空"; msg = "证件号码长度不为18位";
} }
list.push(result);
list.push(msg); } else {
return list; msg = "证件号码不能为空";
}
list.push(result);
list.push(msg);
return list;
} }
/** /**
* 判断手机号码是否正确 * 判断手机号码是否正确
*/ */
export function isvalidatemobile(phone) { export function isvalidatemobile(phone) {
let list = []; let list = [];
let result = true; let result = true;
let msg = ''; let msg = '';
var isPhone = /^0\d{2,3}-?\d{7,8}$/; var isPhone = /^0\d{2,3}-?\d{7,8}$/;
//增加134 减少|1349[0-9]{7},增加181,增加145,增加17[678] //增加134 减少|1349[0-9]{7},增加181,增加145,增加17[678]
if (!validatenull(phone)) { if (!validatenull(phone)) {
if (phone.length == 11) { if (phone.length == 11) {
if (isPhone.test(phone)) { if (isPhone.test(phone)) {
msg = '手机号码格式不正确'; msg = '手机号码格式不正确';
} else { } else {
result = false; result = false;
} }
} else {
msg = '手机号码长度不为11位';
}
} else { } else {
msg = '手机号码不能为空'; msg = '手机号码长度不为11位';
} }
list.push(result); } else {
list.push(msg); msg = '手机号码不能为空';
return list; }
list.push(result);
list.push(msg);
return list;
} }
/** /**
* 判断姓名是否正确 * 判断姓名是否正确
*/ */
export function validatename(name) { export function validatename(name) {
var regName = /^[\u4e00-\u9fa5]{2,4}$/; var regName = /^[\u4e00-\u9fa5]{2,4}$/;
if (!regName.test(name)) return false; if (!regName.test(name)) return false;
return true; return true;
} }
/** /**
* 判断是否为整数 * 判断是否为整数
*/ */
export function validatenum(num, type) { export function validatenum(num, type) {
let regName = /[^\d.]/g; let regName = /[^\d.]/g;
if (type == 1) { if (type == 1) {
if (!regName.test(num)) return false; if (!regName.test(num)) return false;
} else if (type == 2) { } else if (type == 2) {
regName = /[^\d]/g; regName = /[^\d]/g;
if (!regName.test(num)) return false; if (!regName.test(num)) return false;
} }
return true; return true;
} }
/** /**
* 判断是否为小数 * 判断是否为小数
*/ */
export function validatenumord(num, type) { export function validatenumord(num, type) {
let regName = /[^\d.]/g; let regName = /[^\d.]/g;
if (type == 1) { if (type == 1) {
if (!regName.test(num)) return false; if (!regName.test(num)) return false;
} else if (type == 2) { } else if (type == 2) {
regName = /[^\d.]/g; regName = /[^\d.]/g;
if (!regName.test(num)) return false; if (!regName.test(num)) return false;
} }
return true; return true;
} }
/** /**
* 判断是否为空 * 判断是否为空
*/ */
export function validatenull(val) { export function validatenull(val) {
if (typeof val == 'boolean') { if (typeof val == 'boolean') {
return false;
}
if (typeof val == 'number') {
return false;
}
if (val instanceof Array) {
if (val.length == 0) return true;
} else if (val instanceof Object) {
if (JSON.stringify(val) === '{}') return true;
} else {
if (val == 'null' || val == null || val == 'undefined' || val == undefined || val == '') return true;
return false;
}
return false; return false;
} }
\ No newline at end of file if (typeof val == 'number') {
return false;
}
if (val instanceof Array) {
if (val.length == 0) return true;
} else if (val instanceof Object) {
if (JSON.stringify(val) === '{}') return true;
} else {
if (val == 'null' || val == null || val == 'undefined' || val == undefined || val == '') return true;
return false;
}
return false;
}
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
<p class="header__title">{{name}}</p> <p class="header__title">{{name}}</p>
<el-button class="header__btn" <el-button class="header__btn"
type="primary" type="primary"
@click="breaks">关闭返回列表</el-button> @click="breaks">关闭返回列表
</el-button>
</div> </div>
</basic-container> </basic-container>
...@@ -17,51 +18,59 @@ ...@@ -17,51 +18,59 @@
</template> </template>
<script> <script>
export default { export default {
data () { data() {
return { return {
id: '', id: '',
name: '' name: ''
} }
}, },
created () { created() {
this.id = this.$route.params.id this.id = this.$route.params.id
this.name = this.$route.query.name this.name = this.$route.query.name
}, },
computed: { computed: {
src () { src() {
return `${this.actUrl}${this.id}`; return `${this.actUrl}${this.id}`;
} }
}, },
methods: { methods: {
breaks () { breaks() {
this.$router.$avueRouter.closeTag(); this.$router.$avueRouter.closeTag();
this.$router.push({ path: '/activti/activiti' }) this.$router.push({path: '/activti/activiti'})
}
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.header { .execution {
position: relative; height: 99%;
display: flex;
align-items: center; .header {
&__title { position: relative;
font-size: 22px; display: flex;
} align-items: center;
&__btn {
position: absolute; &__title {
right: 10px; font-size: 22px;
}
&__btn {
position: absolute;
right: 10px;
}
}
.main {
margin: 0 auto;
width: 99%;
height: calc(100% - 100px);
background-color: #fff;
padding: 20px;
border-radius: 3px;
box-sizing: border-box;
}
} }
}
.main {
margin: 0 auto;
width: 99%;
height: calc(100% - 100px);
background-color: #fff;
padding: 20px;
border-radius: 3px;
box-sizing: border-box;
}
</style> </style>
...@@ -32,13 +32,16 @@ ...@@ -32,13 +32,16 @@
slot="menuBtn"> slot="menuBtn">
<el-dropdown-item divided <el-dropdown-item divided
v-if="permissions.act_model_manage" v-if="permissions.act_model_manage"
@click.native="handleView(scope.row,scope.index)">模型图</el-dropdown-item> @click.native="handleView(scope.row,scope.index)">模型图
</el-dropdown-item>
<el-dropdown-item divided <el-dropdown-item divided
v-if="permissions.act_model_manage" v-if="permissions.act_model_manage"
@click.native="handleDeploy(scope.row,scope.index)">部署</el-dropdown-item> @click.native="handleDeploy(scope.row,scope.index)">部署
</el-dropdown-item>
<el-dropdown-item divided <el-dropdown-item divided
v-if="permissions.act_model_manage" v-if="permissions.act_model_manage"
@click.native="handleDel(scope.row,scope.index)">删除</el-dropdown-item> @click.native="handleDel(scope.row,scope.index)">删除
</el-dropdown-item>
</template> </template>
</avue-crud> </avue-crud>
...@@ -47,126 +50,125 @@ ...@@ -47,126 +50,125 @@
</template> </template>
<script> <script>
import { fetchList, delObj, addObj, deploy } from '@/api/activiti/activiti' import {addObj, delObj, deploy, fetchList} from '@/api/activiti/activiti'
import { tableOption } from '@/const/crud/activiti/activiti' import {tableOption} from '@/const/crud/activiti/activiti'
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
export default {
name: 'activiti', export default {
data () { name: 'activiti',
return { data() {
tableData: [], return {
page: { tableData: [],
total: 0, // 总页数 page: {
currentPage: 1, // 当前页数 total: 0, // 总页数
pageSize: 20 // 每页显示多少条 currentPage: 1, // 当前页数
}, pageSize: 20 // 每页显示多少条
tableLoading: false, },
tableOption: tableOption tableLoading: false,
} tableOption: tableOption
}, }
created () { },
}, created() {
mounted: function () { },
computed: {
...mapGetters(['permissions'])
},
methods: {
getList (page,params) {
this.tableLoading = true
fetchList(Object.assign({
descs: 'create_time',
current: page.currentPage,
size: page.pageSize
}, params)).then(response => {
this.tableData = response.data.data.records
this.page.total = response.data.data.total
this.tableLoading = false
})
}, },
handleView (row, index) { mounted: function () {
const name = `模型id为${row.id}${row.name}流程图`,
src = `/activti/detail/${row.id}`;
this.$router.push({
path: src,
query: {
name: name
}
})
}, },
handleDel (row, index) { computed: {
this.$refs.crud.rowDel(row, index) ...mapGetters(['permissions'])
}, },
handleDeploy: function (row, index) { methods: {
var _this = this getList(page, params) {
this.$confirm('是否确认部署ID为"' + row.id + '"的模型?', '警告', { this.tableLoading = true
confirmButtonText: '确定', fetchList(Object.assign({
cancelButtonText: '取消', descs: 'create_time',
type: 'warning' current: page.currentPage,
}).then(function () { size: page.pageSize
return deploy(row.id) }, params)).then(response => {
}) this.tableData = response.data.data.records
.then(data => { this.page.total = response.data.data.total
this.tableLoading = false
})
},
handleView(row, index) {
const name = `模型id为${row.id}${row.name}流程图`,
src = `/activti/detail/${row.id}`;
this.$router.push({
path: src,
query: {
name: name
}
})
},
handleDel(row, index) {
this.$refs.crud.rowDel(row, index)
},
handleDeploy: function (row, index) {
var _this = this
this.$confirm('是否确认部署ID为"' + row.id + '"的模型?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
return deploy(row.id)
}).then(data => {
this.getList(this.page) this.getList(this.page)
_this.$message({ _this.$message({
showClose: true, showClose: true,
message: '部署成功', message: '部署成功',
type: 'success' type: 'success'
}) })
}).catch(function (err) {
}) })
.catch(function (err) { }) },
}, rowDel: function (row, index) {
rowDel: function (row, index) { var _this = this
var _this = this this.$confirm('是否确认删除ID为"' + row.id + '"的模型?', '警告', {
this.$confirm('是否确认删除ID为"' + row.id + '"的模型?', '警告', { confirmButtonText: '确定',
confirmButtonText: '确定', cancelButtonText: '取消',
cancelButtonText: '取消', type: 'warning'
type: 'warning' }).then(function () {
})
.then(function () {
return delObj(row.id) return delObj(row.id)
}) }).then(data => {
.then(data => {
this.getList(this.page) this.getList(this.page)
_this.$message({ _this.$message({
showClose: true, showClose: true,
message: '删除成功', message: '删除成功',
type: 'success' type: 'success'
}) })
}).catch(function (err) {
}) })
.catch(function (err) { }) },
}, /**
/** * @title 数据添加
* @title 数据添加 * @param row 为当前的数据
* @param row 为当前的数据 * @param done 为表单关闭函数
* @param done 为表单关闭函数 *
* **/
**/ handleSave: function (row, done) {
handleSave: function (row, done) { addObj(row).then(data => {
addObj(row).then(data => { this.tableData.push(Object.assign({}, row))
this.tableData.push(Object.assign({}, row)) this.$message({
this.$message({ showClose: true,
showClose: true, message: '添加成功',
message: '添加成功', type: 'success'
type: 'success' })
done()
this.getList(this.page)
}) })
done() },
/**
* 搜索回调
*/
searchChange(form) {
this.getList(this.page, form)
},
/**
* 刷新回调
*/
refreshChange() {
this.getList(this.page) this.getList(this.page)
}) }
},
/**
* 搜索回调
*/
searchChange (form) {
this.getList(this.page,form)
},
/**
* 刷新回调
*/
refreshChange () {
this.getList(this.page)
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -33,20 +33,24 @@ ...@@ -33,20 +33,24 @@
<el-button type="primary" <el-button type="primary"
@click="handleAdd" @click="handleAdd"
size="small" size="small"
v-if="permissions.act_leavebill_add">新 增</el-button> v-if="permissions.act_leavebill_add">新 增
</el-button>
</template> </template>
<template slot-scope="scope" <template slot-scope="scope"
slot="menuBtn"> slot="menuBtn">
<el-dropdown-item divided <el-dropdown-item divided
v-if="permissions.act_leavebill_edit && scope.row.state == 0" v-if="permissions.act_leavebill_edit && scope.row.state == 0"
@click.native="handleSubmit(scope.row,scope.index)">提交</el-dropdown-item> @click.native="handleSubmit(scope.row,scope.index)">提交
</el-dropdown-item>
<el-dropdown-item divided <el-dropdown-item divided
v-if="permissions.act_leavebill_edit" v-if="permissions.act_leavebill_edit"
@click.native="handleEdit(scope.row,scope.index)">编辑</el-dropdown-item> @click.native="handleEdit(scope.row,scope.index)">编辑
</el-dropdown-item>
<el-dropdown-item divided <el-dropdown-item divided
v-if="permissions.act_leavebill_del" v-if="permissions.act_leavebill_del"
@click.native="handleDel(scope.row,'suspend')">删除</el-dropdown-item> @click.native="handleDel(scope.row,'suspend')">删除
</el-dropdown-item>
</template> </template>
</avue-crud> </avue-crud>
</basic-container> </basic-container>
...@@ -54,9 +58,10 @@ ...@@ -54,9 +58,10 @@
</template> </template>
<script> <script>
import { fetchList, getObj, addObj, putObj, delObj,submit } from '@/api/activiti/leave-bill' import {addObj, delObj, fetchList, getObj, putObj, submit} from '@/api/activiti/leave-bill'
import { tableOption } from '@/const/crud/activiti/leave-bill' import {tableOption} from '@/const/crud/activiti/leave-bill'
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
export default { export default {
name: 'leave-bill', name: 'leave-bill',
data() { data() {
...@@ -73,127 +78,125 @@ ...@@ -73,127 +78,125 @@
}, },
created() { created() {
}, },
mounted: function() { }, mounted: function () {
},
computed: { computed: {
...mapGetters(['permissions']) ...mapGetters(['permissions'])
}, },
methods: { methods: {
getList(page,params) { getList(page, params) {
this.tableLoading = true this.tableLoading = true
fetchList(Object.assign({ fetchList(Object.assign({
descs: 'create_time', descs: 'create_time',
current: page.currentPage, current: page.currentPage,
size: page.pageSize size: page.pageSize
}, params)).then(response => { }, params)).then(response => {
this.tableData = response.data.data.records this.tableData = response.data.data.records
this.page.total = response.data.data.total this.page.total = response.data.data.total
this.tableLoading = false this.tableLoading = false
}) })
}, },
/** /**
* @title 打开新增窗口 * @title 打开新增窗口
* @detail 调用crud的handleadd方法即可 * @detail 调用crud的handleadd方法即可
* *
**/ **/
handleAdd: function() { handleAdd: function () {
this.$refs.crud.rowAdd() this.$refs.crud.rowAdd()
}, },
handleEdit(row, index) { handleEdit(row, index) {
this.$refs.crud.rowEdit(row, index) this.$refs.crud.rowEdit(row, index)
}, },
handleDel(row, index) { handleDel(row, index) {
this.$refs.crud.rowDel(row, index) this.$refs.crud.rowDel(row, index)
}, },
rowDel: function(row, index) { rowDel: function (row, index) {
var _this = this var _this = this
this.$confirm('是否确认删除ID为' + row.leaveId, '提示', { this.$confirm('是否确认删除ID为' + row.leaveId, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}) }).then(function () {
.then(function() {
return delObj(row.leaveId) return delObj(row.leaveId)
}).then(data => {
_this.tableData.splice(index, 1)
_this.$message({
showClose: true,
message: '删除成功',
type: 'success'
})
}) })
.then(data => {
_this.tableData.splice(index, 1)
_this.$message({
showClose: true,
message: '删除成功',
type: 'success'
})
})
.catch(function(err) { })
},
handleSubmit: function(row, index) {
var _this = this
this.$confirm('是否确认提交ID为' + row.leaveId, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return submit(row.leaveId)
}).then(data => {
_this.tableData.splice(index, 1)
_this.$message({
showClose: true,
message: '提交成功',
type: 'success'
})
this.getList(this.page)
}).catch(function(err) { })
}, },
/** handleSubmit: function (row, index) {
* @title 数据更新 var _this = this
* @param row 为当前的数据 this.$confirm('是否确认提交ID为' + row.leaveId, '提示', {
* @param index 为当前更新数据的行数 confirmButtonText: '确定',
* @param done 为表单关闭函数 cancelButtonText: '取消',
* type: 'warning'
**/ }).then(function () {
handleUpdate: function(row, index, done) { return submit(row.leaveId)
putObj(row).then(data => { }).then(data => {
this.tableData.splice(index, 1, Object.assign({}, row)) _this.tableData.splice(index, 1)
this.$message({ _this.$message({
showClose: true, showClose: true,
message: '修改成功', message: '提交成功',
type: 'success' type: 'success'
}) })
done() this.getList(this.page)
this.getList(this.page) })
}) },
}, /**
/** * @title 数据更新
* @title 数据添加 * @param row 为当前的数据
* @param row 为当前的数据 * @param index 为当前更新数据的行数
* @param done 为表单关闭函数 * @param done 为表单关闭函数
* *
**/ **/
handleSave: function(row, done) { handleUpdate: function (row, index, done) {
addObj(row).then(data => { putObj(row).then(data => {
this.tableData.push(Object.assign({}, row)) this.tableData.splice(index, 1, Object.assign({}, row))
this.$message({ this.$message({
showClose: true, showClose: true,
message: '添加成功', message: '修改成功',
type: 'success' type: 'success'
}) })
done() done()
this.getList(this.page) this.getList(this.page)
}) })
}, },
/** /**
* 搜索回调 * @title 数据添加
*/ * @param row 为当前的数据
searchChange(form) { * @param done 为表单关闭函数
*
**/
handleSave: function (row, done) {
addObj(row).then(data => {
this.tableData.push(Object.assign({}, row))
this.$message({
showClose: true,
message: '添加成功',
type: 'success'
})
done()
this.getList(this.page)
})
},
/**
* 搜索回调
*/
searchChange(form) {
this.page.state = form.state this.page.state = form.state
this.getList(this.page,form) this.getList(this.page, form)
}, },
/** /**
* 刷新回调 * 刷新回调
*/ */
refreshChange() { refreshChange() {
this.getList(this.page) this.getList(this.page)
}
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -34,100 +34,105 @@ ...@@ -34,100 +34,105 @@
divided divided
v-if="permissions.act_process_manage" v-if="permissions.act_process_manage"
@click.native="handlePic(scope.row,scope.index)" @click.native="handlePic(scope.row,scope.index)"
>流程图</el-dropdown-item> >流程图
</el-dropdown-item>
<el-dropdown-item <el-dropdown-item
divided divided
v-if="permissions.act_process_manage && scope.row.suspend" v-if="permissions.act_process_manage && scope.row.suspend"
@click.native="handleStatus(scope.row,'active')" @click.native="handleStatus(scope.row,'active')"
>激活</el-dropdown-item> >激活
</el-dropdown-item>
<el-dropdown-item <el-dropdown-item
divided divided
v-if="permissions.act_process_manage && !scope.row.suspend" v-if="permissions.act_process_manage && !scope.row.suspend"
@click.native="handleStatus(scope.row,'suspend')" @click.native="handleStatus(scope.row,'suspend')"
>失效</el-dropdown-item> >失效
</el-dropdown-item>
<el-dropdown-item <el-dropdown-item
divided divided
v-if="permissions.act_process_manage" v-if="permissions.act_process_manage"
@click.native="handleDel(scope.row,'suspend')" @click.native="handleDel(scope.row,'suspend')"
>删除</el-dropdown-item> >删除
</el-dropdown-item>
</template> </template>
</avue-crud> </avue-crud>
</basic-container> </basic-container>
<el-dialog title="流程图" :visible.sync="showPicDialog"> <el-dialog title="流程图" :visible.sync="showPicDialog">
<img :src="actPicUrl" width="100%" style="margin-left:-60px"> <img :src="actPicUrl" width="100%">
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { fetchList, delObj, addObj, status } from "@/api/activiti/process"; import {addObj, delObj, fetchList, status} from "@/api/activiti/process";
import { tableOption } from "@/const/crud/activiti/process"; import {tableOption} from "@/const/crud/activiti/process";
import { mapGetters } from "vuex"; import {mapGetters} from "vuex";
export default {
name: "process", export default {
data() { name: "process",
return { data() {
showPicDialog: false, return {
actPicUrl: "", showPicDialog: false,
tableData: [], actPicUrl: "",
page: { tableData: [],
total: 0, // 总页数 page: {
currentPage: 1, // 当前页数 total: 0, // 总页数
pageSize: 20 // 每页显示多少条 currentPage: 1, // 当前页数
}, pageSize: 20 // 每页显示多少条
tableLoading: false, },
tableOption: tableOption tableLoading: false,
}; tableOption: tableOption
}, };
created() {}, },
mounted: function() {}, created() {
computed: { },
...mapGetters(["permissions"]) mounted: function () {
},
methods: {
getList(page, params) {
this.tableLoading = true;
fetchList(
Object.assign(
{
descs: "create_time",
current: page.currentPage,
size: page.pageSize
},
params
)
).then(response => {
this.tableData = response.data.data.records;
this.page.total = response.data.data.total;
this.tableLoading = false;
});
}, },
handlePic(row, index) { computed: {
this.actPicUrl = ...mapGetters(["permissions"])
`/act/process/resource/` +
row.deploymentId +
"/" +
row.processonDefinitionId +
"/image";
this.showPicDialog = true;
}, },
handleStatus(row, type) { methods: {
var _this = this; getList(page, params) {
this.$confirm( this.tableLoading = true;
'是否确认操作ID为"' + row.processonDefinitionId + '"的流程?', fetchList(
"警告", Object.assign(
{ {
confirmButtonText: "确定", descs: "create_time",
cancelButtonText: "取消", current: page.currentPage,
type: "warning" size: page.pageSize
} },
) params
.then(function() { )
).then(response => {
this.tableData = response.data.data.records;
this.page.total = response.data.data.total;
this.tableLoading = false;
});
},
handlePic(row, index) {
this.actPicUrl =
`/act/process/resource/` +
row.deploymentId +
"/" +
row.processonDefinitionId +
"/image";
this.showPicDialog = true;
},
handleStatus(row, type) {
var _this = this;
this.$confirm(
'是否确认操作ID为"' + row.processonDefinitionId + '"的流程?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
).then(function () {
return status(row.processonDefinitionId, type); return status(row.processonDefinitionId, type);
}) }).then(data => {
.then(data => {
this.getList(this.page); this.getList(this.page);
_this.$message({ _this.$message({
showClose: true, showClose: true,
...@@ -135,49 +140,46 @@ export default { ...@@ -135,49 +140,46 @@ export default {
type: "success" type: "success"
}); });
}) })
.catch(function(err) {}); },
}, handleDel(row, index) {
handleDel(row, index) { this.$refs.crud.rowDel(row, index);
this.$refs.crud.rowDel(row, index); },
}, rowDel: function (row, index) {
rowDel: function(row, index) { var _this = this;
var _this = this; this.$confirm(
this.$confirm( '是否确认删除ID为"' + row.deploymentId + '"的模型?',
'是否确认删除ID为"' + row.deploymentId + '"的模型?', "警告",
"警告", {
{ confirmButtonText: "确定",
confirmButtonText: "确定", cancelButtonText: "取消",
cancelButtonText: "取消", type: "warning"
type: "warning" }
} ).then(function () {
)
.then(function() {
return delObj(row.deploymentId); return delObj(row.deploymentId);
}) }).then(data => {
.then(data => {
this.getList(this.page); this.getList(this.page);
_this.$message({ _this.$message({
showClose: true, showClose: true,
message: "删除成功", message: "删除成功",
type: "success" type: "success"
}); });
}) }).catch(function (err) {
.catch(function(err) {}); });
}, },
/** /**
* 搜索回调 * 搜索回调
*/ */
searchChange(form) { searchChange(form) {
this.getList(this.page, form); this.getList(this.page, form);
}, },
/** /**
* 刷新回调 * 刷新回调
*/ */
refreshChange() { refreshChange() {
this.getList(this.page); this.getList(this.page);
}
} }
} };
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -29,13 +29,16 @@ ...@@ -29,13 +29,16 @@
slot="menuBtn"> slot="menuBtn">
<el-dropdown-item divided <el-dropdown-item divided
v-if="permissions.act_task_manage" v-if="permissions.act_task_manage"
@click.native="audit(scope.row,scope.index)">审批</el-dropdown-item> @click.native="audit(scope.row,scope.index)">审批
</el-dropdown-item>
<el-dropdown-item divided <el-dropdown-item divided
v-if="permissions.act_task_manage" v-if="permissions.act_task_manage"
@click.native="comment(scope.row,scope.index)">批注</el-dropdown-item> @click.native="comment(scope.row,scope.index)">批注
</el-dropdown-item>
<el-dropdown-item divided <el-dropdown-item divided
v-if="permissions.act_task_manage" v-if="permissions.act_task_manage"
@click.native="viewPic(scope.row,scope.index)">流程图</el-dropdown-item> @click.native="viewPic(scope.row,scope.index)">流程图
</el-dropdown-item>
</template> </template>
</avue-crud> </avue-crud>
</basic-container> </basic-container>
...@@ -43,10 +46,11 @@ ...@@ -43,10 +46,11 @@
:visible.sync="showTask"> :visible.sync="showTask">
<avue-form ref="form" v-model="obj" :option="formOption"> <avue-form ref="form" v-model="obj" :option="formOption">
<template slot-scope="scope" slot="menuForm"> <template slot-scope="scope" slot="menuForm">
<el-button icon="el-icon-check" <el-button icon="el-icon-check"
v-for="flag in flagList" :key="flag" v-for="flag in flagList" :key="flag"
@click="handleTask(scope.row,flag)" @click="handleTask(scope.row,flag)"
plain>{{flag}}</el-button> plain>{{flag}}
</el-button>
</template> </template>
</avue-form> </avue-form>
</el-dialog> </el-dialog>
...@@ -62,16 +66,17 @@ ...@@ -62,16 +66,17 @@
</template> </template>
<script> <script>
import { fetchList,fetchDetail,doTask,fetchComment} from '@/api/activiti/task' import {doTask, fetchComment, fetchDetail, fetchList} from '@/api/activiti/task'
import { tableOption,formOption,taskOption } from '@/const/crud/activiti/task' import {formOption, tableOption, taskOption} from '@/const/crud/activiti/task'
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
export default { export default {
name: 'task', name: 'task',
data() { data() {
return { return {
actPicUrl:'', actPicUrl: '',
obj: {}, obj: {},
flagList:{}, flagList: {},
showTask: false, showTask: false,
showComment: false, showComment: false,
showPicDialog: false, showPicDialog: false,
...@@ -85,85 +90,86 @@ ...@@ -85,85 +90,86 @@
tableLoading: false, tableLoading: false,
tableOption: tableOption, tableOption: tableOption,
formOption: formOption, formOption: formOption,
taskOption:taskOption, taskOption: taskOption,
} }
}, },
created() { created() {
}, },
mounted: function() { }, mounted: function () {
},
computed: { computed: {
...mapGetters(['permissions']) ...mapGetters(['permissions'])
}, },
methods: { methods: {
getList(page,params) { getList(page, params) {
this.tableLoading = true this.tableLoading = true
fetchList(Object.assign({ fetchList(Object.assign({
current: page.currentPage, current: page.currentPage,
size: page.pageSize size: page.pageSize
}, params)).then(response => { }, params)).then(response => {
this.tableData = response.data.data.records this.tableData = response.data.data.records
this.page.total = response.data.data.total this.page.total = response.data.data.total
this.tableLoading = false this.tableLoading = false
})}, })
},
audit:function(row, index) { audit: function (row, index) {
fetchDetail(row.taskId).then(response => { fetchDetail(row.taskId).then(response => {
this.obj = response.data.data this.obj = response.data.data
// 根据连线判断下次的流程 // 根据连线判断下次的流程
this.flagList = this.obj.flagList this.flagList = this.obj.flagList
this.showTask = true this.showTask = true
}) })
this.obj = row this.obj = row
}, },
comment:function(row, index) { comment: function (row, index) {
fetchComment(row.taskId).then(response => { fetchComment(row.taskId).then(response => {
this.taskTableData = response.data.data this.taskTableData = response.data.data
}) })
this.showComment = true this.showComment = true
}, },
handleSubmit: function(row, index) { handleSubmit: function (row, index) {
var _this = this var _this = this
this.$confirm('是否确认提交ID为' + row.leaveId, '提示', { this.$confirm('是否确认提交ID为' + row.leaveId, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(function() { }).then(function () {
return submit(row.leaveId) return submit(row.leaveId)
}) }).then(data => {
.then(data => { _this.tableData.splice(index, 1)
_this.tableData.splice(index, 1) _this.$message({
_this.$message({ showClose: true,
showClose: true, message: '提交成功',
message: '提交成功', type: 'success'
type: 'success'
})
}) })
.catch(function(err) { }) }).catch(function (err) {
})
}, },
handleTask: function(row, result) { handleTask: function (row, result) {
this.obj.taskFlag = result this.obj.taskFlag = result
doTask(this.obj).then(response =>{ doTask(this.obj).then(response => {
this.$message({ this.$message({
showClose: true, showClose: true,
message: '提交成功', message: '提交成功',
type: 'success' type: 'success'
}) })
this.showTask = false this.showTask = false
this.getList(this.page) this.getList(this.page)
}) })
}, },
viewPic: function(row, index) { viewPic: function (row, index) {
this.actPicUrl = `/act/task/view/` + row.taskId this.actPicUrl = `/act/task/view/` + row.taskId
this.showPicDialog = true this.showPicDialog = true
}, },
/** /**
* 刷新回调 * 刷新回调
*/ */
refreshChange() { refreshChange() {
this.getList(this.page) this.getList(this.page)
}
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -35,13 +35,15 @@ ...@@ -35,13 +35,15 @@
icon="el-icon-check" icon="el-icon-check"
size="mini" size="mini"
plain plain
@click="handleEdit(scope.row,scope.index)">编辑</el-button> @click="handleEdit(scope.row,scope.index)">编辑
</el-button>
<el-button type="text" <el-button type="text"
v-if="permissions.sys_client_del" v-if="permissions.sys_client_del"
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
plain plain
@click="handleDel(scope.row,scope.index)">删除</el-button> @click="handleDel(scope.row,scope.index)">删除
</el-button>
</template> </template>
</avue-crud> </avue-crud>
</basic-container> </basic-container>
...@@ -49,66 +51,66 @@ ...@@ -49,66 +51,66 @@
</template> </template>
<script> <script>
import { fetchList, addObj, putObj, delObj } from '@/api/admin/client' import {addObj, delObj, fetchList, putObj} from '@/api/admin/client'
import { tableOption } from '@/const/crud/admin/client' import {tableOption} from '@/const/crud/admin/client'
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
export default {
name: 'client', export default {
data() { name: 'client',
return { data() {
tableData: [], return {
page: { tableData: [],
total: 0, // 总页数 page: {
currentPage: 1, // 当前页数 total: 0, // 总页数
pageSize: 20 // 每页显示多少条 currentPage: 1, // 当前页数
}, pageSize: 20 // 每页显示多少条
tableLoading: false, },
tableOption: tableOption tableLoading: false,
} tableOption: tableOption
}, }
created() {
},
mounted: function() { },
computed: {
...mapGetters(['permissions'])
},
methods: {
getList(page,params) {
this.tableLoading = true
fetchList(Object.assign({
current: page.currentPage,
size: page.pageSize
}, params)).then(response => {
this.tableData = response.data.data.records
this.page.total = response.data.data.total
this.tableLoading = false
})
}, },
/** created() {
* @title 打开新增窗口
* @detail 调用crud的handleadd方法即可
*
**/
handleAdd: function() {
this.$refs.crud.rowAdd()
}, },
handleEdit(row, index) { mounted: function () {
this.$refs.crud.rowEdit(row, index)
}, },
handleDel(row, index) { computed: {
this.$refs.crud.rowDel(row, index) ...mapGetters(['permissions'])
}, },
rowDel: function(row, index) { methods: {
var _this = this getList(page, params) {
this.$confirm('是否确认删除ID为' + row.clientId, '提示', { this.tableLoading = true
confirmButtonText: '确定', fetchList(Object.assign({
cancelButtonText: '取消', current: page.currentPage,
type: 'warning' size: page.pageSize
}) }, params)).then(response => {
.then(function() { this.tableData = response.data.data.records
return delObj(row.clientId) this.page.total = response.data.data.total
this.tableLoading = false
}) })
.then(data => { },
/**
* @title 打开新增窗口
* @detail 调用crud的handleadd方法即可
*
**/
handleAdd: function () {
this.$refs.crud.rowAdd()
},
handleEdit(row, index) {
this.$refs.crud.rowEdit(row, index)
},
handleDel(row, index) {
this.$refs.crud.rowDel(row, index)
},
rowDel: function (row, index) {
var _this = this
this.$confirm('是否确认删除ID为' + row.clientId, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
return delObj(row.clientId)
}).then(data => {
_this.tableData.splice(index, 1) _this.tableData.splice(index, 1)
_this.$message({ _this.$message({
showClose: true, showClose: true,
...@@ -116,54 +118,54 @@ export default { ...@@ -116,54 +118,54 @@ export default {
type: 'success' type: 'success'
}) })
this.refreshChange() this.refreshChange()
}).catch(function (err) {
}) })
.catch(function(err) { }) },
}, /**
/** * @title 数据更新
* @title 数据更新 * @param row 为当前的数据
* @param row 为当前的数据 * @param index 为当前更新数据的行数
* @param index 为当前更新数据的行数 * @param done 为表单关闭函数
* @param done 为表单关闭函数 *
* **/
**/ handleUpdate: function (row, index, done) {
handleUpdate: function(row, index, done) { putObj(row).then(data => {
putObj(row).then(data => { this.tableData.splice(index, 1, Object.assign({}, row))
this.tableData.splice(index, 1, Object.assign({}, row)) this.$message({
this.$message({ showClose: true,
showClose: true, message: '修改成功',
message: '修改成功', type: 'success'
type: 'success' })
this.refreshChange()
done()
}) })
this.refreshChange() },
done() /**
}) * @title 数据添加
}, * @param row 为当前的数据
/** * @param done 为表单关闭函数
* @title 数据添加 *
* @param row 为当前的数据 **/
* @param done 为表单关闭函数 handleSave: function (row, done) {
* addObj(row).then(data => {
**/ this.tableData.push(Object.assign({}, row))
handleSave: function(row, done) { this.$message({
addObj(row).then(data => { showClose: true,
this.tableData.push(Object.assign({}, row)) message: '添加成功',
this.$message({ type: 'success'
showClose: true, })
message: '添加成功', this.refreshChange()
type: 'success' done()
}) })
this.refreshChange() },
done() /**
}) * 刷新回调
}, */
/** refreshChange() {
* 刷新回调 this.getList(this.page)
*/ }
refreshChange() {
this.getList(this.page)
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -23,15 +23,18 @@ ...@@ -23,15 +23,18 @@
<el-button type="primary" <el-button type="primary"
v-if="deptManager_btn_add" v-if="deptManager_btn_add"
icon="plus" icon="plus"
@click="handlerAdd">添加</el-button> @click="handlerAdd">添加
</el-button>
<el-button type="primary" <el-button type="primary"
v-if="deptManager_btn_edit" v-if="deptManager_btn_edit"
icon="edit" icon="edit"
@click="handlerEdit">编辑</el-button> @click="handlerEdit">编辑
</el-button>
<el-button type="primary" <el-button type="primary"
v-if="deptManager_btn_del" v-if="deptManager_btn_del"
icon="delete" icon="delete"
@click="handleDelete">删除</el-button> @click="handleDelete">删除
</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -78,18 +81,20 @@ ...@@ -78,18 +81,20 @@
<el-form-item label="排序" <el-form-item label="排序"
prop="orderNum"> prop="orderNum">
<el-input type="number" <el-input type="number"
v-model="form.sort" v-model="form.sort"
:disabled="formEdit" :disabled="formEdit"
placeholder="请输入排序"></el-input> placeholder="请输入排序"></el-input>
</el-form-item> </el-form-item>
<el-form-item v-if="formStatus == 'update'"> <el-form-item v-if="formStatus == 'update'">
<el-button type="primary" <el-button type="primary"
@click="update">更新</el-button> @click="update">更新
</el-button>
<el-button @click="onCancel">取消</el-button> <el-button @click="onCancel">取消</el-button>
</el-form-item> </el-form-item>
<el-form-item v-if="formStatus == 'create'"> <el-form-item v-if="formStatus == 'create'">
<el-button type="primary" <el-button type="primary"
@click="create">保存</el-button> @click="create">保存
</el-button>
<el-button @click="onCancel">取消</el-button> <el-button @click="onCancel">取消</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -101,153 +106,154 @@ ...@@ -101,153 +106,154 @@
</template> </template>
<script> <script>
import { fetchTree, getObj, addObj, delObj, putObj } from '@/api/admin/dept' import {addObj, delObj, fetchTree, getObj, putObj} from '@/api/admin/dept'
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
export default {
name: 'dept', export default {
data () { name: 'dept',
return { data() {
list: null, return {
total: null, list: null,
formEdit: true, total: null,
formAdd: true, formEdit: true,
formStatus: '', formAdd: true,
showElement: false, formStatus: '',
typeOptions: ['0', '1'], showElement: false,
methodOptions: ['GET', 'POST', 'PUT', 'DELETE'], typeOptions: ['0', '1'],
listQuery: { methodOptions: ['GET', 'POST', 'PUT', 'DELETE'],
name: undefined listQuery: {
name: undefined
},
treeData: [],
defaultProps: {
children: 'children',
label: 'name'
},
rules: {
parentId: [
{required: true, message: '请输入父级节点', trigger: 'blur'}
],
deptId: [
{required: true, message: '请输入节点编号', trigger: 'blur'}
],
name: [
{required: true, message: '请输入部门名称', trigger: 'blur'}
],
},
labelPosition: 'right',
form: {
name: undefined,
orderNum: undefined,
parentId: undefined,
deptId: undefined
},
currentId: 0,
deptManager_btn_add: false,
deptManager_btn_edit: false,
deptManager_btn_del: false
}
},
created() {
this.getList()
this.deptManager_btn_add = this.permissions['sys_dept_add']
this.deptManager_btn_edit = this.permissions['sys_dept_edit']
this.deptManager_btn_del = this.permissions['sys_dept_del']
},
computed: {
...mapGetters([
'elements',
'permissions'
])
},
methods: {
getList() {
fetchTree(this.listQuery).then(response => {
this.treeData = response.data.data
})
}, },
treeData: [], filterNode(value, data) {
defaultProps: { if (!value) return true
children: 'children', return data.label.indexOf(value) !== -1
label: 'name'
}, },
rules: { getNodeData(data) {
parentId: [ if (!this.formEdit) {
{ required: true, message: '请输入父级节点', trigger: 'blur' } this.formStatus = 'update'
], }
deptId: [ getObj(data.id).then(response => {
{ required: true, message: '请输入节点编号', trigger: 'blur' } this.form = response.data.data
], })
name: [ this.currentId = data.id
{ required: true, message: '请输入部门名称', trigger: 'blur' } this.showElement = true
],
}, },
labelPosition: 'right', handlerEdit() {
form: { if (this.form.deptId) {
name: undefined, this.formEdit = false
orderNum: undefined, this.formStatus = 'update'
parentId: undefined, }
deptId: undefined
}, },
currentId: 0, handlerAdd() {
deptManager_btn_add: false, this.resetForm()
deptManager_btn_edit: false,
deptManager_btn_del: false
}
},
created () {
this.getList()
this.deptManager_btn_add = this.permissions['sys_dept_add']
this.deptManager_btn_edit = this.permissions['sys_dept_edit']
this.deptManager_btn_del = this.permissions['sys_dept_del']
},
computed: {
...mapGetters([
'elements',
'permissions'
])
},
methods: {
getList () {
fetchTree(this.listQuery).then(response => {
this.treeData = response.data.data
})
},
filterNode (value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
getNodeData (data) {
if (!this.formEdit) {
this.formStatus = 'update'
}
getObj(data.id).then(response => {
this.form = response.data.data
})
this.currentId = data.id
this.showElement = true
},
handlerEdit () {
if (this.form.deptId) {
this.formEdit = false this.formEdit = false
this.formStatus = 'update' this.formStatus = 'create'
} },
}, handleDelete() {
handlerAdd () { this.$confirm('此操作将永久删除, 是否继续?', '提示', {
this.resetForm() confirmButtonText: '确定',
this.formEdit = false cancelButtonText: '取消',
this.formStatus = 'create' type: 'warning'
}, }).then(() => {
handleDelete () { delObj(this.currentId).then(() => {
this.$confirm('此操作将永久删除, 是否继续?', '提示', { this.getList()
confirmButtonText: '确定', this.resetForm()
cancelButtonText: '取消', this.onCancel()
type: 'warning' this.$notify({
}).then(() => { title: '成功',
delObj(this.currentId).then(() => { message: '删除成功',
this.getList() type: 'success',
this.resetForm() duration: 2000
this.onCancel() })
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
}) })
}) })
}) },
}, update() {
update () { this.$refs.form.validate((valid) => {
this.$refs.form.validate((valid) => { if (!valid) return
if (!valid) return putObj(this.form).then(() => {
putObj(this.form).then(() => { this.getList()
this.getList() this.$notify({
this.$notify({ title: '成功',
title: '成功', message: '更新成功',
message: '更新成功', type: 'success',
type: 'success', duration: 2000
duration: 2000 })
}) })
}) })
})
}, },
create () { create() {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (!valid) return if (!valid) return
addObj(this.form).then(() => { addObj(this.form).then(() => {
this.getList() this.getList()
this.$notify({ this.$notify({
title: '成功', title: '成功',
message: '创建成功', message: '创建成功',
type: 'success', type: 'success',
duration: 2000 duration: 2000
})
}) })
}) })
}) },
}, onCancel() {
onCancel () { this.formEdit = true
this.formEdit = true this.formStatus = ''
this.formStatus = '' },
}, resetForm() {
resetForm () { this.form = {
this.form = { parentId: this.currentId,
parentId: this.currentId, }
} }
} }
} }
}
</script> </script>
...@@ -35,13 +35,15 @@ ...@@ -35,13 +35,15 @@
icon="el-icon-check" icon="el-icon-check"
size="mini" size="mini"
plain plain
@click="handleEdit(scope.row,scope.index)">编辑</el-button> @click="handleEdit(scope.row,scope.index)">编辑
</el-button>
<el-button type="text" <el-button type="text"
v-if="permissions.sys_dict_del" v-if="permissions.sys_dict_del"
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
plain plain
@click="handleDel(scope.row,scope.index)">删除</el-button> @click="handleDel(scope.row,scope.index)">删除
</el-button>
</template> </template>
</avue-crud> </avue-crud>
</basic-container> </basic-container>
...@@ -49,117 +51,117 @@ ...@@ -49,117 +51,117 @@
</template> </template>
<script> <script>
import { fetchList, addObj, putObj, delObj } from '@/api/admin/dict' import {addObj, delObj, fetchList, putObj} from '@/api/admin/dict'
import { tableOption } from '@/const/crud/admin/dict' import {tableOption} from '@/const/crud/admin/dict'
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
export default {
name: 'dict', export default {
data () { name: 'dict',
return { data() {
tableData: [], return {
page: { tableData: [],
total: 0, // 总页数 page: {
currentPage: 1, // 当前页数 total: 0, // 总页数
pageSize: 20 // 每页显示多少条 currentPage: 1, // 当前页数
}, pageSize: 20 // 每页显示多少条
tableLoading: false, },
tableOption: tableOption tableLoading: false,
} tableOption: tableOption
}, }
created () {
},
mounted: function () { },
computed: {
...mapGetters(['permissions'])
},
methods: {
getList (page,params) {
this.tableLoading = true
fetchList(Object.assign({
current: page.currentPage,
size: page.pageSize
}, params)).then(response => {
this.tableData = response.data.data.records
this.page.total = response.data.data.total
this.tableLoading = false
})
}, },
/** created() {
* @title 打开新增窗口
* @detail 调用crud的handleadd方法即可
*
**/
handleAdd: function () {
this.$refs.crud.rowAdd()
}, },
handleEdit (row, index) { mounted: function () {
this.$refs.crud.rowEdit(row, index)
}, },
handleDel (row, index) { computed: {
this.$refs.crud.rowDel(row, index) ...mapGetters(['permissions'])
}, },
rowDel: function (row, index) { methods: {
var _this = this getList(page, params) {
this.$confirm('是否确认删除标签名为"' + row.label + '",数据类型为"' + row.type + '"的数据项?', '警告', { this.tableLoading = true
confirmButtonText: '确定', fetchList(Object.assign({
cancelButtonText: '取消', current: page.currentPage,
type: 'warning' size: page.pageSize
}) }, params)).then(response => {
.then(function () { this.tableData = response.data.data.records
return delObj(row) this.page.total = response.data.data.total
this.tableLoading = false
}) })
.then(() => { },
/**
* @title 打开新增窗口
* @detail 调用crud的handleadd方法即可
*
**/
handleAdd: function () {
this.$refs.crud.rowAdd()
},
handleEdit(row, index) {
this.$refs.crud.rowEdit(row, index)
},
handleDel(row, index) {
this.$refs.crud.rowDel(row, index)
},
rowDel: function (row, index) {
var _this = this
this.$confirm('是否确认删除标签名为"' + row.label + '",数据类型为"' + row.type + '"的数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
return delObj(row)
}).then(() => {
this.getList(this.page) this.getList(this.page)
_this.$message({ _this.$message({
showClose: true, showClose: true,
message: '删除成功', message: '删除成功',
type: 'success' type: 'success'
}) })
}).catch(function () {
}) })
.catch(function () { }) },
}, /**
/** * @title 数据更新
* @title 数据更新 * @param row 为当前的数据
* @param row 为当前的数据 * @param index 为当前更新数据的行数
* @param index 为当前更新数据的行数 * @param done 为表单关闭函数
* @param done 为表单关闭函数 *
* **/
**/ handleUpdate: function (row, index, done) {
handleUpdate: function (row, index, done) { putObj(row).then(() => {
putObj(row).then(() => { this.tableData.splice(index, 1, Object.assign({}, row))
this.tableData.splice(index, 1, Object.assign({}, row)) this.$message({
this.$message({ showClose: true,
showClose: true, message: '修改成功',
message: '修改成功', type: 'success'
type: 'success' })
this.getList(this.page)
done()
}) })
this.getList(this.page) },
done() /**
}) * @title 数据添加
}, * @param row 为当前的数据
/** * @param done 为表单关闭函数
* @title 数据添加 *
* @param row 为当前的数据 **/
* @param done 为表单关闭函数 handleSave: function (row, done) {
* addObj(row).then(data => {
**/ this.tableData.push(Object.assign({}, row))
handleSave: function (row, done) { this.$message({
addObj(row).then(data => { showClose: true,
this.tableData.push(Object.assign({}, row)) message: '添加成功',
this.$message({ type: 'success'
showClose: true, })
message: '添加成功', this.getList(this.page)
type: 'success' done()
}) })
this.getList(this.page) },
done() searchChange(form) {
}) this.getList(this.page, form)
}, }
searchChange (form) {
this.getList(this.page,form)
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
v-if="permissions.sys_log_del" v-if="permissions.sys_log_del"
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
@click="handleDel(scope.row,scope.index)">删除</el-button> @click="handleDel(scope.row,scope.index)">删除
</el-button>
</template> </template>
</avue-crud> </avue-crud>
</basic-container> </basic-container>
...@@ -41,79 +42,79 @@ ...@@ -41,79 +42,79 @@
</template> </template>
<script> <script>
import { fetchList, delObj } from '@/api/admin/log' import {delObj, fetchList} from '@/api/admin/log'
import { tableOption } from '@/const/crud/admin/log' import {tableOption} from '@/const/crud/admin/log'
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
export default {
name: 'log', export default {
data () { name: 'log',
return { data() {
tableData: [], return {
page: { tableData: [],
total: 0, // 总页数 page: {
currentPage: 1, // 当前页数 total: 0, // 总页数
pageSize: 20 // 每页显示多少条 currentPage: 1, // 当前页数
}, pageSize: 20 // 每页显示多少条
tableLoading: false, },
tableOption: tableOption tableLoading: false,
} tableOption: tableOption
}, }
created () {
},
mounted: function () { },
computed: {
...mapGetters(['permissions'])
},
methods: {
getList (page, params) {
this.tableLoading = true
fetchList(Object.assign({
descs: 'create_time',
current: page.currentPage,
size: page.pageSize
}, params)).then(response => {
this.tableData = response.data.data.records
this.page.total = response.data.data.total
this.tableLoading = false
})
}, },
handleDel (row, index) { created() {
this.$refs.crud.rowDel(row, index)
}, },
rowDel: function (row, index) { mounted: function () {
var _this = this },
this.$confirm('是否确认删除ID为"' + row.id + '"的日志?', '警告', { computed: {
confirmButtonText: '确定', ...mapGetters(['permissions'])
cancelButtonText: '取消', },
type: 'warning' methods: {
}) getList(page, params) {
.then(function () { this.tableLoading = true
return delObj(row.id) fetchList(Object.assign({
descs: 'create_time',
current: page.currentPage,
size: page.pageSize
}, params)).then(response => {
this.tableData = response.data.data.records
this.page.total = response.data.data.total
this.tableLoading = false
}) })
.then(data => { },
handleDel(row, index) {
this.$refs.crud.rowDel(row, index)
},
rowDel: function (row, index) {
var _this = this
this.$confirm('是否确认删除ID为"' + row.id + '"的日志?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
return delObj(row.id)
}).then(data => {
this.getList(this.page) this.getList(this.page)
_this.$message({ _this.$message({
showClose: true, showClose: true,
message: '删除成功', message: '删除成功',
type: 'success' type: 'success'
}) })
}).catch(function (err) {
}) })
.catch(function (err) { }) },
}, /**
/** * 搜索回调
* 搜索回调 */
*/ searchChange(form) {
searchChange (form) { this.getList(this.page, form)
this.getList(this.page, form) },
}, /**
/** * 刷新回调
* 刷新回调 */
*/ refreshChange() {
refreshChange () { this.getList(this.page)
this.getList(this.page) }
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -23,15 +23,18 @@ ...@@ -23,15 +23,18 @@
<el-button type="primary" <el-button type="primary"
v-if="menuManager_btn_add" v-if="menuManager_btn_add"
icon="plus" icon="plus"
@click="handlerAdd">添加</el-button> @click="handlerAdd">添加
</el-button>
<el-button type="primary" <el-button type="primary"
v-if="menuManager_btn_edit" v-if="menuManager_btn_edit"
icon="edit" icon="edit"
@click="handlerEdit">编辑</el-button> @click="handlerEdit">编辑
</el-button>
<el-button type="primary" <el-button type="primary"
v-if="menuManager_btn_del" v-if="menuManager_btn_del"
icon="delete" icon="delete"
@click="handleDelete">删除</el-button> @click="handleDelete">删除
</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -96,7 +99,7 @@ ...@@ -96,7 +99,7 @@
<el-option v-for="item in typeOptions" <el-option v-for="item in typeOptions"
:key="item" :key="item"
:label="item | typeFilter" :label="item | typeFilter"
:value="item"> </el-option> :value="item"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="排序" <el-form-item label="排序"
...@@ -130,12 +133,14 @@ ...@@ -130,12 +133,14 @@
</el-form-item> </el-form-item>
<el-form-item v-if="formStatus == 'update'"> <el-form-item v-if="formStatus == 'update'">
<el-button type="primary" <el-button type="primary"
@click="update">更新</el-button> @click="update">更新
</el-button>
<el-button @click="onCancel">取消</el-button> <el-button @click="onCancel">取消</el-button>
</el-form-item> </el-form-item>
<el-form-item v-if="formStatus == 'create'"> <el-form-item v-if="formStatus == 'create'">
<el-button type="primary" <el-button type="primary"
@click="create">保存</el-button> @click="create">保存
</el-button>
<el-button @click="onCancel">取消</el-button> <el-button @click="onCancel">取消</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -147,202 +152,202 @@ ...@@ -147,202 +152,202 @@
</template> </template>
<script> <script>
import { addObj, delObj, fetchTree, getObj, putObj } from '@/api/admin/menu' import {addObj, delObj, fetchTree, getObj, putObj} from '@/api/admin/menu'
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
export default { export default {
name: 'menu', name: 'menu',
data () { data() {
return { return {
list: null, list: null,
total: null, total: null,
formEdit: true, formEdit: true,
formAdd: true, formAdd: true,
formStatus: '', formStatus: '',
showElement: false, showElement: false,
typeOptions: ['0', '1'], typeOptions: ['0', '1'],
methodOptions: ['GET', 'POST', 'PUT', 'DELETE'], methodOptions: ['GET', 'POST', 'PUT', 'DELETE'],
listQuery: { listQuery: {
name: undefined name: undefined
}, },
treeData: [], treeData: [],
oExpandedKey: { oExpandedKey: {
// key (from tree id) : expandedOrNot boolean // key (from tree id) : expandedOrNot boolean
}, },
oTreeNodeChildren: { oTreeNodeChildren: {
// id1 : [children] (from tree node id1) // id1 : [children] (from tree node id1)
// id2 : [children] (from tree node id2) // id2 : [children] (from tree node id2)
}, },
aExpandedKeys: [], aExpandedKeys: [],
defaultProps: { defaultProps: {
children: 'children', children: 'children',
label: 'name' label: 'name'
}, },
labelPosition: 'right', labelPosition: 'right',
form: { form: {
permission: undefined, permission: undefined,
name: undefined, name: undefined,
menuId: undefined, menuId: undefined,
parentId: undefined, parentId: undefined,
icon: undefined, icon: undefined,
sort: undefined, sort: undefined,
component: undefined, component: undefined,
type: undefined, type: undefined,
path: undefined path: undefined
}, },
currentId: -1, currentId: -1,
menuManager_btn_add: false, menuManager_btn_add: false,
menuManager_btn_edit: false, menuManager_btn_edit: false,
menuManager_btn_del: false menuManager_btn_del: false
}
},
filters: {
typeFilter (type) {
const typeMap = {
0: '菜单',
1: '按钮'
} }
return typeMap[type]
}
},
created () {
this.getList()
this.menuManager_btn_add = this.permissions['sys_menu_add']
this.menuManager_btn_edit = this.permissions['sys_menu_edit']
this.menuManager_btn_del = this.permissions['sys_menu_del']
},
computed: {
...mapGetters([
'elements',
'permissions'
])
},
methods: {
getList () {
fetchTree(this.listQuery).then(response => {
this.treeData = response.data.data
})
}, },
filterNode (value, data) { filters: {
if (!value) return true typeFilter(type) {
return data.label.indexOf(value) !== -1 const typeMap = {
}, 0: '菜单',
1: '按钮'
nodeExpand (data) { }
let aChildren = data.children return typeMap[type]
if (aChildren.length > 0) {
this.oExpandedKey[data.id] = true
this.oTreeNodeChildren[data.id] = aChildren
} }
this.setExpandedKeys()
}, },
nodeCollapse (data) { created() {
this.oExpandedKey[data.id] = false this.getList()
// 如果有子节点 this.menuManager_btn_add = this.permissions['sys_menu_add']
this.treeRecursion(this.oTreeNodeChildren[data.id], (oNode) => { this.menuManager_btn_edit = this.permissions['sys_menu_edit']
this.oExpandedKey[oNode.id] = false this.menuManager_btn_del = this.permissions['sys_menu_del']
});
this.setExpandedKeys()
}, },
setExpandedKeys () { computed: {
let oTemp = this.oExpandedKey ...mapGetters([
this.aExpandedKeys = [] 'elements',
for (let sKey in oTemp) { 'permissions'
if (oTemp[sKey]) { ])
this.aExpandedKeys.push(parseInt(sKey));
}
}
}, },
treeRecursion (aChildren, fnCallback) { methods: {
if (aChildren) { getList() {
for (let i = 0; i < aChildren.length; ++i) { fetchTree(this.listQuery).then(response => {
let oNode = aChildren[i] this.treeData = response.data.data
fnCallback && fnCallback(oNode) })
this.treeRecursion(oNode.children, fnCallback) },
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
nodeExpand(data) {
let aChildren = data.children
if (aChildren.length > 0) {
this.oExpandedKey[data.id] = true
this.oTreeNodeChildren[data.id] = aChildren
} }
} this.setExpandedKeys()
}, },
nodeCollapse(data) {
this.oExpandedKey[data.id] = false
// 如果有子节点
this.treeRecursion(this.oTreeNodeChildren[data.id], (oNode) => {
this.oExpandedKey[oNode.id] = false
});
this.setExpandedKeys()
},
setExpandedKeys() {
let oTemp = this.oExpandedKey
this.aExpandedKeys = []
for (let sKey in oTemp) {
if (oTemp[sKey]) {
this.aExpandedKeys.push(parseInt(sKey));
}
}
},
treeRecursion(aChildren, fnCallback) {
if (aChildren) {
for (let i = 0; i < aChildren.length; ++i) {
let oNode = aChildren[i]
fnCallback && fnCallback(oNode)
this.treeRecursion(oNode.children, fnCallback)
}
}
},
getNodeData (data) { getNodeData(data) {
if (!this.formEdit) { if (!this.formEdit) {
this.formStatus = 'update' this.formStatus = 'update'
} }
getObj(data.id).then(response => { getObj(data.id).then(response => {
this.form = response.data.data this.form = response.data.data
}) })
this.currentId = data.id this.currentId = data.id
this.showElement = true this.showElement = true
}, },
handlerEdit () { handlerEdit() {
if (this.form.menuId) { if (this.form.menuId) {
this.formEdit = false
this.formStatus = 'update'
}
},
handlerAdd() {
this.resetForm()
this.formEdit = false this.formEdit = false
this.formStatus = 'update' this.formStatus = 'create'
} },
}, handleDelete() {
handlerAdd () { this.$confirm('此操作将永久删除, 是否继续?', '提示', {
this.resetForm() confirmButtonText: '确定',
this.formEdit = false cancelButtonText: '取消',
this.formStatus = 'create' type: 'warning'
}, }).then(() => {
handleDelete () { delObj(this.currentId).then(() => {
this.$confirm('此操作将永久删除, 是否继续?', '提示', { this.getList()
confirmButtonText: '确定', this.resetForm()
cancelButtonText: '取消', this.onCancel()
type: 'warning' this.$notify({
}).then(() => { title: '成功',
delObj(this.currentId).then(() => { message: '删除成功',
type: 'success',
duration: 2000
})
})
})
},
update() {
putObj(this.form).then(() => {
this.getList() this.getList()
this.resetForm()
this.onCancel()
this.$notify({ this.$notify({
title: '成功', title: '成功',
message: '删除成功', message: '更新成功',
type: 'success', type: 'success',
duration: 2000 duration: 2000
}) })
}) })
}) },
}, create() {
update () { addObj(this.form).then(() => {
putObj(this.form).then(() => { this.getList()
this.getList() this.$notify({
this.$notify({ title: '成功',
title: '成功', message: '创建成功',
message: '更新成功', type: 'success',
type: 'success', duration: 2000
duration: 2000 })
})
})
},
create () {
addObj(this.form).then(() => {
this.getList()
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
}) })
}) },
}, onCancel() {
onCancel () { this.formEdit = true
this.formEdit = true this.formStatus = ''
this.formStatus = '' },
}, resetForm() {
resetForm () { this.form = {
this.form = { permission: undefined,
permission: undefined, name: undefined,
name: undefined, menuId: undefined,
menuId: undefined, parentId: this.currentId,
parentId: this.currentId, icon: undefined,
icon: undefined, sort: undefined,
sort: undefined, component: undefined,
component: undefined, type: undefined,
type: undefined, path: undefined
path: undefined }
} }
} }
} }
}
</script> </script>
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
@click="handleCreate" @click="handleCreate"
size="small" size="small"
type="primary" type="primary"
icon="el-icon-edit">添加</el-button> icon="el-icon-edit">添加
</el-button>
</template> </template>
<template slot="menu" <template slot="menu"
slot-scope="scope"> slot-scope="scope">
...@@ -80,194 +81,188 @@ ...@@ -80,194 +81,188 @@
<div slot="footer" <div slot="footer"
class="dialog-footer"> class="dialog-footer">
<el-button type="primary" <el-button type="primary"
@click="updatePermession(roleId, roleCode)">更 新</el-button> @click="updatePermession(roleId, roleCode)">更 新
</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { import {addObj, delObj, fetchList, fetchRoleTree, getObj, permissionUpd, putObj} from '@/api/admin/role'
fetchList, import {fetchTree} from '@/api/admin/menu'
getObj, import {mapGetters} from 'vuex'
addObj, import {tableOption} from '@/const/crud/admin/role'
putObj,
delObj, export default {
permissionUpd, name: 'table_role',
fetchRoleTree data() {
} from '@/api/admin/role' return {
import { fetchTree } from '@/api/admin/menu' tableOption: tableOption,
import { mapGetters } from 'vuex' treeData: [],
import { tableOption } from '@/const/crud/admin/role' checkedKeys: [],
export default { defaultProps: {
name: 'table_role', label: "name",
data () { value: 'id'
return { },
tableOption: tableOption, page: {
treeData: [], total: 0, // 总页数
checkedKeys: [], currentPage: 1, // 当前页数
defaultProps: { pageSize: 20 // 每页显示多少条
label: "name", },
value: 'id' menuIds: '',
}, list: [],
page: { listLoading: true,
total: 0, // 总页数 form: {},
currentPage: 1, // 当前页数 roleId: undefined,
pageSize: 20 // 每页显示多少条 roleCode: undefined,
}, rolesOptions: undefined,
menuIds: '', dialogPermissionVisible: false,
list: [], roleManager_btn_add: false,
listLoading: true, roleManager_btn_edit: false,
form: {}, roleManager_btn_del: false,
roleId: undefined, roleManager_btn_perm: false
roleCode: undefined,
rolesOptions: undefined,
dialogPermissionVisible: false,
roleManager_btn_add: false,
roleManager_btn_edit: false,
roleManager_btn_del: false,
roleManager_btn_perm: false
}
},
created () {
this.roleManager_btn_add = this.permissions['sys_role_add']
this.roleManager_btn_edit = this.permissions['sys_role_edit']
this.roleManager_btn_del = this.permissions['sys_role_del']
this.roleManager_btn_perm = this.permissions['sys_role_perm']
},
computed: {
...mapGetters(['elements', 'permissions'])
},
methods: {
getList (page, params) {
this.listLoading = true
fetchList(Object.assign({
current: page.currentPage,
size: page.pageSize
}, params)).then(response => {
this.list = response.data.data.records
this.page.total = response.data.data.total
this.listLoading = false
})
},
handleRefreshChange () {
this.getList(this.page)
},
handleFilter (param) {
this.page.page = 1;
this.getList(this.page, param);
},
handleCreate () {
this.$refs.crud.rowAdd();
},
handleOpenBefore (show, type) {
show();
},
handleUpdate (row, index) {
this.$refs.crud.rowEdit(row, index);
},
handlePermission (row) {
fetchRoleTree(row.roleId)
.then(response => {
this.checkedKeys = response.data
return fetchTree()
})
.then(response => {
this.treeData = response.data.data
// 解析出所有的太监节点
this.checkedKeys = this.resolveAllEunuchNodeId(this.treeData, this.checkedKeys, [])
this.dialogStatus = 'permission'
this.dialogPermissionVisible = true
this.roleId = row.roleId
this.roleCode = row.roleCode
})
},
/**
* 解析出所有的太监节点id
* @param json 待解析的json串
* @param idArr 原始节点数组
* @param temp 临时存放节点id的数组
* @return 太监节点id数组
*/
resolveAllEunuchNodeId (json, idArr, temp) {
for (let i = 0; i < json.length; i++) {
const item = json[i]
// 存在子节点,递归遍历;不存在子节点,将json的id添加到临时数组中
if (item.children && item.children.length !== 0) {
this.resolveAllEunuchNodeId(item.children, idArr, temp)
} else {
temp.push(idArr.filter(id => id === item.id))
}
} }
return temp
},
filterNode (value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
}, },
getNodeData (data, done) { created() {
done(); this.roleManager_btn_add = this.permissions['sys_role_add']
this.roleManager_btn_edit = this.permissions['sys_role_edit']
this.roleManager_btn_del = this.permissions['sys_role_del']
this.roleManager_btn_perm = this.permissions['sys_role_perm']
}, },
handleDelete (row, index) { computed: {
delObj(row.roleId).then(response => { ...mapGetters(['elements', 'permissions'])
this.list.splice(index, 1);
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
})
})
}, },
create (row, done, loading) { methods: {
addObj(this.form).then(() => { getList(page, params) {
this.getList(this.page) this.listLoading = true
done(); fetchList(Object.assign({
this.$notify({ current: page.currentPage,
title: '成功', size: page.pageSize
message: '创建成功', }, params)).then(response => {
type: 'success', this.list = response.data.data.records
duration: 2000 this.page.total = response.data.data.total
this.listLoading = false
}) })
}).catch(() => { },
loading(); handleRefreshChange() {
});
},
update (row, index, done, loading) {
putObj(this.form).then(() => {
this.getList(this.page) this.getList(this.page)
done(); },
this.$notify({ handleFilter(param) {
title: '成功', this.page.page = 1;
message: '修改成功', this.getList(this.page, param);
type: 'success', },
duration: 2000 handleCreate() {
}) this.$refs.crud.rowAdd();
}).catch(() => { },
loading(); handleOpenBefore(show, type) {
}); show();
}, },
updatePermession (roleId, roleCode) { handleUpdate(row, index) {
this.menuIds = '' this.$refs.crud.rowEdit(row, index);
this.menuIds = this.$refs.menuTree.getCheckedKeys().join(',').concat(',').concat(this.$refs.menuTree.getHalfCheckedKeys().join(',')) },
permissionUpd(roleId, this.menuIds).then(() => { handlePermission(row) {
this.dialogPermissionVisible = false fetchRoleTree(row.roleId)
fetchTree()
.then(response => { .then(response => {
this.form = response.data.data this.checkedKeys = response.data
return fetchRoleTree(roleId) return fetchTree()
}) })
.then(response => { .then(response => {
this.checkedKeys = response.data this.treeData = response.data.data
this.$notify({ // 解析出所有的太监节点
title: '成功', this.checkedKeys = this.resolveAllEunuchNodeId(this.treeData, this.checkedKeys, [])
message: '修改成功', this.dialogStatus = 'permission'
type: 'success', this.dialogPermissionVisible = true
duration: 2000 this.roleId = row.roleId
}) this.roleCode = row.roleCode
})
},
/**
* 解析出所有的太监节点id
* @param json 待解析的json串
* @param idArr 原始节点数组
* @param temp 临时存放节点id的数组
* @return 太监节点id数组
*/
resolveAllEunuchNodeId(json, idArr, temp) {
for (let i = 0; i < json.length; i++) {
const item = json[i]
// 存在子节点,递归遍历;不存在子节点,将json的id添加到临时数组中
if (item.children && item.children.length !== 0) {
this.resolveAllEunuchNodeId(item.children, idArr, temp)
} else {
temp.push(idArr.filter(id => id === item.id))
}
}
return temp
},
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
getNodeData(data, done) {
done();
},
handleDelete(row, index) {
delObj(row.roleId).then(response => {
this.list.splice(index, 1);
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
})
})
},
create(row, done, loading) {
addObj(this.form).then(() => {
this.getList(this.page)
done();
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
})
}).catch(() => {
loading();
});
},
update(row, index, done, loading) {
putObj(this.form).then(() => {
this.getList(this.page)
done();
this.$notify({
title: '成功',
message: '修改成功',
type: 'success',
duration: 2000
}) })
}) }).catch(() => {
loading();
});
},
updatePermession(roleId, roleCode) {
this.menuIds = ''
this.menuIds = this.$refs.menuTree.getCheckedKeys().join(',').concat(',').concat(this.$refs.menuTree.getHalfCheckedKeys().join(','))
permissionUpd(roleId, this.menuIds).then(() => {
this.dialogPermissionVisible = false
fetchTree()
.then(response => {
this.form = response.data.data
return fetchRoleTree(roleId)
})
.then(response => {
this.checkedKeys = response.data
this.$notify({
title: '成功',
message: '修改成功',
type: 'success',
duration: 2000
})
})
})
}
} }
} }
}
</script> </script>
...@@ -16,68 +16,68 @@ ...@@ -16,68 +16,68 @@
--> -->
<template> <template>
<div class="execution"> <div class="execution">
<basic-container> <basic-container>
<el-alert <el-alert
title="路由配置是非常专业的事情,不建议非工程师操作" title="路由配置是非常专业的事情,不建议非工程师操作"
type="warning"> type="warning">
</el-alert> </el-alert>
<vue-json-editor v-model="json" :show-btns="false"></vue-json-editor> <vue-json-editor v-model="json" :show-btns="false"></vue-json-editor>
<div align="center"> <div align="center">
<el-button @click="edit()">更新</el-button> <el-button @click="edit()">更新</el-button>
</div> </div>
</basic-container> </basic-container>
</div> </div>
</template> </template>
<script> <script>
import vueJsonEditor from 'vue-json-editor' import vueJsonEditor from 'vue-json-editor'
import {fetchList, putObj, fallback} from '@/api/admin/route' import {fallback, fetchList, putObj} from '@/api/admin/route'
export default { export default {
data() { data() {
return { return {
json: null json: null
} }
}, },
// 注入vueJsonEditor组件
components: {
vueJsonEditor
},
created() { // 注入vueJsonEditor组件
this.getList() components: {
}, vueJsonEditor
},
methods: { created() {
getList() { this.getList()
fetchList().then(response => { },
let result = response.data.data;
for (var i = 0; i < result.length; i++) {
let route = result[i]
if(route.predicates){
let predicates = route.predicates
route.predicates = JSON.parse(predicates)
}
if(route.filters){
let filters = route.filters
route.filters = JSON.parse(filters)
}
}
this.json = result
})
},
edit() { methods: {
putObj(this.json).then(response => { getList() {
this.$notify({ fetchList().then(response => {
title: '成功', let result = response.data.data;
message: '更新成功', for (var i = 0; i < result.length; i++) {
type: 'success', let route = result[i]
duration: 2000 if (route.predicates) {
}) let predicates = route.predicates
}) route.predicates = JSON.parse(predicates)
} }
} if (route.filters) {
let filters = route.filters
route.filters = JSON.parse(filters)
}
}
this.json = result
})
},
edit() {
putObj(this.json).then(response => {
this.$notify({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
})
})
}
} }
}
</script> </script>
...@@ -33,8 +33,9 @@ ...@@ -33,8 +33,9 @@
<el-button type="primary" <el-button type="primary"
@click="handleAdd" @click="handleAdd"
size="small" size="small"
v-if="permissions.generator_syssocialdetails_add">新 增</el-button> v-if="permissions.generator_syssocialdetails_add">新 增
<br /><br /> </el-button>
<br/><br/>
</template> </template>
<template slot-scope="scope" <template slot-scope="scope"
slot="menu"> slot="menu">
...@@ -43,13 +44,15 @@ ...@@ -43,13 +44,15 @@
icon="el-icon-check" icon="el-icon-check"
size="small" size="small"
plain plain
@click="handleEdit(scope.row,scope.index)">编辑</el-button> @click="handleEdit(scope.row,scope.index)">编辑
</el-button>
<el-button type="text" <el-button type="text"
v-if="permissions.generator_syssocialdetails_del" v-if="permissions.generator_syssocialdetails_del"
icon="el-icon-delete" icon="el-icon-delete"
size="small" size="small"
plain plain
@click="handleDel(scope.row,scope.index)">删除</el-button> @click="handleDel(scope.row,scope.index)">删除
</el-button>
</template> </template>
</avue-crud> </avue-crud>
</basic-container> </basic-container>
...@@ -57,66 +60,66 @@ ...@@ -57,66 +60,66 @@
</template> </template>
<script> <script>
import { fetchList, getObj, addObj, putObj, delObj } from '@/api/admin/sys-social-details' import {addObj, delObj, fetchList, getObj, putObj} from '@/api/admin/sys-social-details'
import { tableOption } from '@/const/crud/admin/sys-social-details' import {tableOption} from '@/const/crud/admin/sys-social-details'
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
export default {
name: 'sys-social-details', export default {
data () { name: 'sys-social-details',
return { data() {
tableData: [], return {
page: { tableData: [],
total: 0, // 总页数 page: {
currentPage: 1, // 当前页数 total: 0, // 总页数
pageSize: 20 // 每页显示多少条 currentPage: 1, // 当前页数
}, pageSize: 20 // 每页显示多少条
tableLoading: false, },
tableOption: tableOption tableLoading: false,
} tableOption: tableOption
}, }
created () {
},
mounted: function () { },
computed: {
...mapGetters(['permissions'])
},
methods: {
getList (page,params) {
this.tableLoading = true
fetchList(Object.assign({
current: page.currentPage,
size: page.pageSize
}, params)).then(response => {
this.tableData = response.data.data.records
this.page.total = response.data.data.total
this.tableLoading = false
})
}, },
/** created() {
* @title 打开新增窗口
* @detail 调用crud的handleadd方法即可
*
**/
handleAdd: function () {
this.$refs.crud.rowAdd()
}, },
handleEdit (row, index) { mounted: function () {
this.$refs.crud.rowEdit(row, index)
}, },
handleDel (row, index) { computed: {
this.$refs.crud.rowDel(row, index) ...mapGetters(['permissions'])
}, },
rowDel: function (row, index) { methods: {
var _this = this getList(page, params) {
this.$confirm('是否确认删除ID为' + row.id, '提示', { this.tableLoading = true
confirmButtonText: '确定', fetchList(Object.assign({
cancelButtonText: '取消', current: page.currentPage,
type: 'warning' size: page.pageSize
}) }, params)).then(response => {
.then(function () { this.tableData = response.data.data.records
return delObj(row.id) this.page.total = response.data.data.total
this.tableLoading = false
}) })
.then(data => { },
/**
* @title 打开新增窗口
* @detail 调用crud的handleadd方法即可
*
**/
handleAdd: function () {
this.$refs.crud.rowAdd()
},
handleEdit(row, index) {
this.$refs.crud.rowEdit(row, index)
},
handleDel(row, index) {
this.$refs.crud.rowDel(row, index)
},
rowDel: function (row, index) {
var _this = this
this.$confirm('是否确认删除ID为' + row.id, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
return delObj(row.id)
}).then(data => {
_this.tableData.splice(index, 1) _this.tableData.splice(index, 1)
_this.$message({ _this.$message({
showClose: true, showClose: true,
...@@ -124,60 +127,60 @@ export default { ...@@ -124,60 +127,60 @@ export default {
type: 'success' type: 'success'
}) })
this.refreshChange() this.refreshChange()
}).catch(function (err) {
}) })
.catch(function (err) { }) },
}, /**
/** * @title 数据更新
* @title 数据更新 * @param row 为当前的数据
* @param row 为当前的数据 * @param index 为当前更新数据的行数
* @param index 为当前更新数据的行数 * @param done 为表单关闭函数
* @param done 为表单关闭函数 *
* **/
**/ handleUpdate: function (row, index, done) {
handleUpdate: function (row, index, done) { putObj(row).then(data => {
putObj(row).then(data => { this.tableData.splice(index, 1, Object.assign({}, row))
this.tableData.splice(index, 1, Object.assign({}, row)) this.$message({
this.$message({ showClose: true,
showClose: true, message: '修改成功',
message: '修改成功', type: 'success'
type: 'success' })
this.refreshChange()
done()
}) })
},
/**
* @title 数据添加
* @param row 为当前的数据
* @param done 为表单关闭函数
*
**/
handleSave: function (row, done) {
addObj(row).then(() => {
this.tableData.push(Object.assign({}, row))
this.$message({
showClose: true,
message: '添加成功',
type: 'success'
})
this.refreshChange() this.refreshChange()
done() done()
})
},
/**
* @title 数据添加
* @param row 为当前的数据
* @param done 为表单关闭函数
*
**/
handleSave: function (row, done) {
addObj(row).then(() => {
this.tableData.push(Object.assign({}, row))
this.$message({
showClose: true,
message: '添加成功',
type: 'success'
}) })
this.refreshChange() },
done() /**
}) * 刷新回调
}, */
/** refreshChange() {
* 刷新回调 this.getList(this.page)
*/ },
refreshChange () { /**
this.getList(this.page) * 搜索回调
}, */
/** searchChange(form) {
* 搜索回调 this.getList(this.page, form)
*/ }
searchChange (form) {
this.getList(this.page,form)
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
plain plain
@click="handleDel(scope.row,scope.index)">删除</el-button> @click="handleDel(scope.row,scope.index)">删除
</el-button>
</template> </template>
</avue-crud> </avue-crud>
</basic-container> </basic-container>
...@@ -41,72 +42,72 @@ ...@@ -41,72 +42,72 @@
</template> </template>
<script> <script>
import { fetchList, delObj } from '@/api/admin/token' import {delObj, fetchList} from '@/api/admin/token'
import { tableOption } from '@/const/crud/admin/token' import {tableOption} from '@/const/crud/admin/token'
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
export default {
name: 'token', export default {
data() { name: 'token',
return { data() {
tableData: [], return {
page: { tableData: [],
total: 0, // 总页数 page: {
currentPage: 1, // 当前页数 total: 0, // 总页数
pageSize: 20 // 每页显示多少条 currentPage: 1, // 当前页数
}, pageSize: 20 // 每页显示多少条
tableLoading: false, },
tableOption: tableOption tableLoading: false,
} tableOption: tableOption
}, }
created() {
},
mounted: function() { },
computed: {
...mapGetters(['permissions'])
},
methods: {
getList(page,params) {
this.tableLoading = true
fetchList(Object.assign({
current: page.currentPage,
size: page.pageSize
}, params)).then(response => {
this.tableData = response.data.data.records
this.page.total = response.data.data.total
this.tableLoading = false
})
}, },
handleDel(row, index) { created() {
this.$refs.crud.rowDel(row, index)
}, },
rowDel: function(row, index) { mounted: function () {
var _this = this },
this.$confirm('是否确认删除ID为' + row.token_value, '提示', { computed: {
confirmButtonText: '确定', ...mapGetters(['permissions'])
cancelButtonText: '取消', },
type: 'warning' methods: {
}) getList(page, params) {
.then(function() { this.tableLoading = true
return delObj(row.token_value) fetchList(Object.assign({
current: page.currentPage,
size: page.pageSize
}, params)).then(response => {
this.tableData = response.data.data.records
this.page.total = response.data.data.total
this.tableLoading = false
}) })
.then(data => { },
handleDel(row, index) {
this.$refs.crud.rowDel(row, index)
},
rowDel: function (row, index) {
var _this = this
this.$confirm('是否确认删除ID为' + row.token_value, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
return delObj(row.token_value)
}).then(data => {
_this.tableData.splice(index, 1) _this.tableData.splice(index, 1)
_this.$message({ _this.$message({
showClose: true, showClose: true,
message: '删除成功', message: '删除成功',
type: 'success' type: 'success'
}) })
}).catch(function (err) {
}) })
.catch(function(err) { }) },
}, /**
/** * 刷新回调
* 刷新回调 */
*/ refreshChange() {
refreshChange() { this.getList(this.page)
this.getList(this.page) }
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -50,7 +50,8 @@ ...@@ -50,7 +50,8 @@
@click="handleCreate" @click="handleCreate"
size="small" size="small"
type="primary" type="primary"
icon="el-icon-edit">添加</el-button> icon="el-icon-edit">添加
</el-button>
</template> </template>
<template slot="username" <template slot="username"
slot-scope="scope"> slot-scope="scope">
...@@ -112,209 +113,202 @@ ...@@ -112,209 +113,202 @@
</template> </template>
<script> <script>
import { fetchList, getObj, addObj, putObj, delObj } from "@/api/admin/user"; import {addObj, delObj, fetchList, getObj, putObj} from "@/api/admin/user";
import { deptRoleList } from "@/api/admin/role"; import {deptRoleList} from "@/api/admin/role";
import { fetchDeptTree } from "@/api/admin/dept"; import {fetchDeptTree} from "@/api/admin/dept";
import { tableOption } from '@/const/crud/admin/user'; import {tableOption} from '@/const/crud/admin/user';
import { mapGetters } from "vuex"; import {mapGetters} from "vuex";
import { constants } from 'fs'; import {constants} from 'fs';
import { connect } from 'tls'; import {connect} from 'tls';
export default {
name: "table_user", export default {
data () { name: "table_user",
return { data() {
treeOption: { return {
nodeKey: 'id', treeOption: {
addBtn: false, nodeKey: 'id',
menu: false, addBtn: false,
props: { menu: false,
label: 'name', props: {
value: 'id' label: 'name',
} value: 'id'
}, }
treeData: [], },
option: tableOption, treeData: [],
treeDeptData: [], option: tableOption,
checkedKeys: [], treeDeptData: [],
roleProps: { checkedKeys: [],
label: "roleName", roleProps: {
value: 'roleId' label: "roleName",
}, value: 'roleId'
defaultProps: { },
label: "name", defaultProps: {
value: 'id', label: "name",
}, value: 'id',
page: { },
total: 0, // 总页数 page: {
currentPage: 1, // 当前页数 total: 0, // 总页数
pageSize: 20, // 每页显示多少条, currentPage: 1, // 当前页数
isAsc: false//是否倒序 pageSize: 20, // 每页显示多少条,
}, isAsc: false//是否倒序
list: [], },
listLoading: true, list: [],
role: [], listLoading: true,
form: {}, role: [],
rolesOptions: [], form: {},
}; rolesOptions: [],
},
computed: {
...mapGetters(["permissions"])
},
watch: {
role () {
this.form.role = this.role
}
},
filters: {
statusFilter (status) {
const statusMap = {
0: "有效",
1: "无效",
9: "锁定"
}; };
return statusMap[status];
}
},
created () {
this.sys_user_add = this.permissions["sys_user_add"];
this.sys_user_edit = this.permissions["sys_user_edit"];
this.sys_user_del = this.permissions["sys_user_del"];
this.init();
},
methods: {
init () {
fetchDeptTree().then(response => {
this.treeData = response.data.data;
});
},
nodeClick (data) {
this.page.page = 1;
this.getList(this.page, { deptId: data.id });
},
getList (page, params) {
this.listLoading = true;
fetchList(Object.assign({
current: page.currentPage,
size: page.pageSize
}, params)).then(response => {
this.list = response.data.data.records;
this.page.total = response.data.data.total
this.listLoading = false;
});
},
getNodeData (data) {
deptRoleList().then(response => {
this.rolesOptions = response.data.data;
});
},
handleDept () {
fetchDeptTree().then(response => {
this.treeDeptData = response.data.data;
});
}, },
handleFilter (param) { computed: {
this.page.page = 1; ...mapGetters(["permissions"])
this.getList(this.page, param);
}, },
handleRefreshChange () { watch: {
this.getList(this.page) role() {
this.form.role = this.role
}
}, },
handleCreate () { created() {
this.$refs.crud.rowAdd(); this.sys_user_add = this.permissions["sys_user_add"];
this.sys_user_edit = this.permissions["sys_user_edit"];
this.sys_user_del = this.permissions["sys_user_del"];
this.init();
}, },
handleOpenBefore (show, type) { methods: {
window.boxType = type; init() {
this.handleDept(); fetchDeptTree().then(response => {
if (['edit', 'views'].includes(type)) { this.treeData = response.data.data;
this.role = []; });
for (var i = 0; i < this.form.roleList.length; i++) { },
this.role[i] = this.form.roleList[i].roleId; nodeClick(data) {
} this.page.page = 1;
this.getList(this.page, {deptId: data.id});
},
getList(page, params) {
this.listLoading = true;
fetchList(Object.assign({
current: page.currentPage,
size: page.pageSize
}, params)).then(response => {
this.list = response.data.data.records;
this.page.total = response.data.data.total
this.listLoading = false;
});
},
getNodeData(data) {
deptRoleList().then(response => { deptRoleList().then(response => {
this.rolesOptions = response.data.data; this.rolesOptions = response.data.data;
}); });
} else if (type === 'add') { },
this.role = []; handleDept() {
} fetchDeptTree().then(response => {
show(); this.treeDeptData = response.data.data;
},
handleUpdate (row, index) {
this.$refs.crud.rowEdit(row, index);
this.form.password = undefined
},
create (row, done, loading) {
addObj(this.form).then(() => {
this.getList(this.page);
done();
this.$notify({
title: "成功",
message: "创建成功",
type: "success",
duration: 2000
});
}).catch(() => {
loading();
});
},
update (row, index, done, loading) {
putObj(this.form).then(() => {
this.getList(this.page);
done();
this.$notify({
title: "成功",
message: "修改成功",
type: "success",
duration: 2000
}); });
}).catch(() => { },
loading(); handleFilter(param) {
}); this.page.page = 1;
}, this.getList(this.page, param);
deletes (row, index) { },
this.$confirm( handleRefreshChange() {
"此操作将永久删除该用户(用户名:" + row.username + "), 是否继续?", this.getList(this.page)
"提示", },
{ handleCreate() {
confirmButtonText: "确定", this.$refs.crud.rowAdd();
cancelButtonText: "取消", },
type: "warning" handleOpenBefore(show, type) {
window.boxType = type;
this.handleDept();
if (['edit', 'views'].includes(type)) {
this.role = [];
for (var i = 0; i < this.form.roleList.length; i++) {
this.role[i] = this.form.roleList[i].roleId;
}
deptRoleList().then(response => {
this.rolesOptions = response.data.data;
});
} else if (type === 'add') {
this.role = [];
} }
).then(() => { show();
delObj(row.userId) },
.then(() => { handleUpdate(row, index) {
this.list.splice(index, 1); this.$refs.crud.rowEdit(row, index);
this.$notify({ this.form.password = undefined
title: "成功", },
message: "删除成功", create(row, done, loading) {
type: "success", addObj(this.form).then(() => {
duration: 2000 this.getList(this.page);
}); done();
}) this.$notify({
.cache(() => { title: "成功",
this.$notify({ message: "创建成功",
title: "失败", type: "success",
message: "删除失败", duration: 2000
type: "error",
duration: 2000
});
}); });
}); }).catch(() => {
loading();
});
},
update(row, index, done, loading) {
putObj(this.form).then(() => {
this.getList(this.page);
done();
this.$notify({
title: "成功",
message: "修改成功",
type: "success",
duration: 2000
});
}).catch(() => {
loading();
});
},
deletes(row, index) {
this.$confirm(
"此操作将永久删除该用户(用户名:" + row.username + "), 是否继续?",
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
).then(() => {
delObj(row.userId)
.then(() => {
this.list.splice(index, 1);
this.$notify({
title: "成功",
message: "删除成功",
type: "success",
duration: 2000
});
})
.cache(() => {
this.$notify({
title: "失败",
message: "删除失败",
type: "error",
duration: 2000
});
});
});
}
} }
} };
};
</script> </script>
<style lang="scss"> <style lang="scss">
.user { .user {
height: 100%; height: 100%;
&__tree {
padding-top: 3px; &__tree {
padding-right: 20px; padding-top: 3px;
} padding-right: 20px;
&__main { }
.el-card__body {
padding-top: 0; &__main {
.el-card__body {
padding-top: 0;
}
} }
} }
}
</style> </style>
...@@ -58,7 +58,8 @@ ...@@ -58,7 +58,8 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" <el-button type="primary"
@click="submitForm('ruleForm2')">提交</el-button> @click="submitForm('ruleForm2')">提交
</el-button>
<el-button @click="resetForm('ruleForm2')">重置</el-button> <el-button @click="resetForm('ruleForm2')">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -71,91 +72,89 @@ ...@@ -71,91 +72,89 @@
<script> <script>
import { openWindow } from '@/util/util' import {openWindow} from '@/util/util'
import { mapState } from 'vuex' import {mapState} from 'vuex'
import { getToken } from '@/util/auth' import {getToken} from '@/util/auth'
import ElFormItem from 'element-ui/packages/form/src/form-item.vue' import request from '@/router/axios'
import request from '@/router/axios'
export default { export default {
components: { components: {
ElFormItem ElFormItem
}, },
data () { data() {
var validatePass = (rule, value, callback) => { var validatePass = (rule, value, callback) => {
if (this.ruleForm2.password !== '') { if (this.ruleForm2.password !== '') {
if (value === '') { if (value === '') {
callback(new Error('请再次输入密码')) callback(new Error('请再次输入密码'))
} else if (value !== this.ruleForm2.newpassword1) { } else if (value !== this.ruleForm2.newpassword1) {
callback(new Error('两次输入密码不一致!')) callback(new Error('两次输入密码不一致!'))
} else {
callback()
}
} else { } else {
callback() callback()
} }
} else {
callback()
} }
} return {
return { fileList: [],
fileList: [], show: false,
show: false, headers: {
headers: { Authorization: 'Bearer ' + getToken()
Authorization: 'Bearer ' + getToken() },
}, ruleForm2: {
ruleForm2: { username: '',
username: '', password: '',
password: '', newpassword1: '',
newpassword1: '', newpassword2: ''
newpassword2: '' },
}, rules2: {
rules2: { password: [{required: true, min: 6, message: '原密码不能为空且不少于6位', trigger: 'change'}],
password: [{ required: true, min: 6, message: '原密码不能为空且不少于6位', trigger: 'change' }], newpassword1: [{required: true, min: 6, message: '新密码不能为空且不少于6位', trigger: 'change'}],
newpassword1: [{ required: true, min: 6, message: '新密码不能为空且不少于6位', trigger: 'change' }], newpassword2: [{required: true, validator: validatePass, trigger: 'blur'}]
newpassword2: [{ required: true, validator: validatePass, trigger: 'blur' }] }
} }
} },
}, created() {
created () { this.ruleForm2.username = this.userInfo.username
this.ruleForm2.username = this.userInfo.username },
}, computed: {
computed: { ...mapState({
...mapState({ userInfo: state => state.user.userInfo
userInfo: state => state.user.userInfo }),
}), },
}, methods: {
methods: { submitForm(formName) {
submitForm (formName) { this.$refs[formName].validate(valid => {
this.$refs[formName].validate(valid => { if (valid) {
if (valid) { request({
request({ url: '/admin/user/edit',
url: '/admin/user/edit', method: 'put',
method: 'put', data: this.ruleForm2
data: this.ruleForm2 }).then(response => {
}).then(response => { if (response.data.data) {
if (response.data.data) { this.$notify({
this.$notify({ title: '成功',
title: '成功', message: '修改成功',
message: '修改成功', type: 'success',
type: 'success', duration: 2000
duration: 2000
})
// 修改密码之后强制重新登录
if (this.ruleForm2.newpassword1 !== '') {
this.$store.dispatch('LogOut').then(() => {
location.reload() // 为了重新实例化vue-router对象 避免bug
}) })
// 修改密码之后强制重新登录
if (this.ruleForm2.newpassword1 !== '') {
this.$store.dispatch('LogOut').then(() => {
location.reload() // 为了重新实例化vue-router对象 避免bug
})
} else {
this.$router.push({path: '/'})
}
} else { } else {
this.$router.push({ path: '/' }) this.$notify({
title: '失败',
message: response.data.msg,
type: 'error',
duration: 2000
})
} }
} else { }).catch(() => {
this.$notify({
title: '失败',
message: response.data.msg,
type: 'error',
duration: 2000
})
}
})
.catch(() => {
this.$notify({ this.$notify({
title: '失败', title: '失败',
message: '修改失败', message: '修改失败',
...@@ -163,38 +162,26 @@ export default { ...@@ -163,38 +162,26 @@ export default {
duration: 2000 duration: 2000
}) })
}) })
} else { } else {
return false return false
}
})
},
resetForm(formName) {
this.$refs[formName].resetFields()
},
handleClick(thirdpart) {
let appid, client_id, redirect_uri, url
redirect_uri = encodeURIComponent(window.location.origin + '/#/authredirect?type=BIND')
if (thirdpart === 'wechat') {
appid = 'wxd1678d3f83b1d83a'
url = 'https://open.weixin.qq.com/connect/qrconnect?appid=' + appid + '&redirect_uri=' + redirect_uri + '&state=' + appid + '&response_type=code&scope=snsapi_login#wechat_redirect'
} else if (thirdpart === 'tencent') {
client_id = '101322838'
url = 'https://graph.qq.com/oauth2.0/authorize?response_type=code&state=' + appid + '&client_id=' + client_id + '&redirect_uri=' + redirect_uri
} }
}) openWindow(url, thirdpart, 540, 540)
},
resetForm (formName) {
this.$refs[formName].resetFields()
},
toggleShow () {
this.show = !this.show
},
/**
* upload success
*
* [param] jsonData 服务器返回数据,已进行json转码
* [param] field
*/
cropUploadSuccess (jsonData) {
this.$store.commit('SET_AVATAR', jsonData.filename)
},
handleClick (thirdpart) {
let appid, client_id, redirect_uri, url
redirect_uri = encodeURIComponent(window.location.origin + '/#/authredirect?type=BIND')
if (thirdpart === 'wechat') {
appid = 'wxd1678d3f83b1d83a'
url = 'https://open.weixin.qq.com/connect/qrconnect?appid=' + appid + '&redirect_uri=' + redirect_uri + '&state=' + appid + '&response_type=code&scope=snsapi_login#wechat_redirect'
} else if (thirdpart === 'tencent') {
client_id = '101322838'
url = 'https://graph.qq.com/oauth2.0/authorize?response_type=code&state=' + appid + '&client_id=' + client_id + '&redirect_uri=' + redirect_uri
} }
openWindow(url, thirdpart, 540, 540)
} }
} }
}
</script> </script>
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<a :href='props.row.address' <a :href='props.row.address'
target="_blank"> target="_blank">
<img :src="props.row.stars" <img :src="props.row.stars"
alt='star' /> alt='star'/>
</a> </a>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
<a :href='scope.row.git' <a :href='scope.row.git'
target="_blank"> target="_blank">
<img :src="scope.row.stars" <img :src="scope.row.stars"
alt='star' /> alt='star'/>
</a> </a>
</template> </template>
<template slot-scope="scope" <template slot-scope="scope"
...@@ -75,82 +75,87 @@ ...@@ -75,82 +75,87 @@
</template> </template>
<script> <script>
import { tableOption } from '@/const/crud/option' import {tableOption} from '@/const/crud/option'
import { tableData } from '@/const/crud/data' import {tableData} from '@/const/crud/data'
export default {
name: 'crud', export default {
data () { name: 'crud',
return { data() {
tableData: tableData, return {
tableOption: tableOption tableData: tableData,
} tableOption: tableOption
}, }
mounted: function () { },
methods: {
handleDel: function (row, index) {
var _this = this
this.$confirm('是否确认删除序号为' + row.username, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(function () {
_this.tableData.splice(index, 1)
_this.$message({
showClose: true,
message: '删除成功',
type: 'success'
})
})
.catch(function (err) { })
}, },
/** mounted: function () {
* @title 数据更新
* @param row 为当前的数据
* @param index 为当前更新数据的行数
* @param done 为表单关闭函数
*
**/
handleUpdate: function (row, index, done) {
this.tableData.splice(index, 1, Object.assign({}, row))
this.$message({
showClose: true,
message: '修改成功',
type: 'success'
})
done()
}, },
/** methods: {
* @title 数据添加 handleDel: function (row, index) {
* @param row 为当前的数据 var _this = this
* @param done 为表单关闭函数 this.$confirm('是否确认删除序号为' + row.username, '提示', {
* confirmButtonText: '确定',
**/ cancelButtonText: '取消',
handleSave: function (row, done) { type: 'warning'
this.tableData.push(Object.assign({}, row)) })
this.$message({ .then(function () {
showClose: true, _this.tableData.splice(index, 1)
message: '添加成功', _this.$message({
type: 'success' showClose: true,
}) message: '删除成功',
done() type: 'success'
})
})
.catch(function (err) {
})
},
/**
* @title 数据更新
* @param row 为当前的数据
* @param index 为当前更新数据的行数
* @param done 为表单关闭函数
*
**/
handleUpdate: function (row, index, done) {
this.tableData.splice(index, 1, Object.assign({}, row))
this.$message({
showClose: true,
message: '修改成功',
type: 'success'
})
done()
},
/**
* @title 数据添加
* @param row 为当前的数据
* @param done 为表单关闭函数
*
**/
handleSave: function (row, done) {
this.tableData.push(Object.assign({}, row))
this.$message({
showClose: true,
message: '添加成功',
type: 'success'
})
done()
}
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.demo-table-expand { .demo-table-expand {
font-size: 0; font-size: 0;
} }
.demo-table-expand label {
width: 90px; .demo-table-expand label {
color: #99a9bf; width: 90px;
} color: #99a9bf;
.demo-table-expand .el-form-item { }
margin-right: 0;
margin-bottom: 0; .demo-table-expand .el-form-item {
width: 50%; margin-right: 0;
} margin-bottom: 0;
width: 50%;
}
</style> </style>
...@@ -35,7 +35,8 @@ ...@@ -35,7 +35,8 @@
icon="el-icon-delete" icon="el-icon-delete"
size="small" size="small"
plain plain
@click="handleDel(scope.row,scope.index)">删除</el-button> @click="handleDel(scope.row,scope.index)">删除
</el-button>
</template> </template>
</avue-crud> </avue-crud>
</basic-container> </basic-container>
...@@ -43,9 +44,10 @@ ...@@ -43,9 +44,10 @@
</template> </template>
<script> <script>
import { fetchList, getObj, addObj, putObj, delObj } from '@/api/daemon/execution-log' import {addObj, delObj, fetchList, getObj, putObj} from '@/api/daemon/execution-log'
import { tableOption } from '@/const/crud/daemon/execution-log' import {tableOption} from '@/const/crud/daemon/execution-log'
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
export default { export default {
name: 'execution-log', name: 'execution-log',
data() { data() {
...@@ -61,14 +63,15 @@ ...@@ -61,14 +63,15 @@
} }
}, },
created() { created() {
this.page.pageSize=20; this.page.pageSize = 20;
},
mounted: function () {
}, },
mounted: function() { },
computed: { computed: {
...mapGetters(['permissions']) ...mapGetters(['permissions'])
}, },
methods: { methods: {
getList(page, params={}) { getList(page, params = {}) {
this.tableLoading = true this.tableLoading = true
fetchList(Object.assign({ fetchList(Object.assign({
current: page.currentPage, current: page.currentPage,
...@@ -85,7 +88,7 @@ ...@@ -85,7 +88,7 @@
* @detail 调用crud的handleadd方法即可 * @detail 调用crud的handleadd方法即可
* *
**/ **/
handleAdd: function() { handleAdd: function () {
this.$refs.crud.rowAdd() this.$refs.crud.rowAdd()
}, },
handleEdit(row, index) { handleEdit(row, index) {
...@@ -94,17 +97,15 @@ ...@@ -94,17 +97,15 @@
handleDel(row, index) { handleDel(row, index) {
this.$refs.crud.rowDel(row, index) this.$refs.crud.rowDel(row, index)
}, },
rowDel: function(row, index) { rowDel: function (row, index) {
var _this = this var _this = this
this.$confirm('是否确认删除ID为' + row.id, '提示', { this.$confirm('是否确认删除ID为' + row.id, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}) }).then(function () {
.then(function() { return delObj(row.id)
return delObj(row.id) }).then(data => {
})
.then(data => {
_this.tableData.splice(index, 1) _this.tableData.splice(index, 1)
_this.$message({ _this.$message({
showClose: true, showClose: true,
...@@ -112,8 +113,8 @@ ...@@ -112,8 +113,8 @@
type: 'success' type: 'success'
}) })
this.getList(this.page) this.getList(this.page)
}).catch(function (err) {
}) })
.catch(function(err) { })
}, },
/** /**
* @title 数据更新 * @title 数据更新
...@@ -122,7 +123,7 @@ ...@@ -122,7 +123,7 @@
* @param done 为表单关闭函数 * @param done 为表单关闭函数
* *
**/ **/
handleUpdate: function(row, index, done) { handleUpdate: function (row, index, done) {
putObj(row).then(data => { putObj(row).then(data => {
this.tableData.splice(index, 1, Object.assign({}, row)) this.tableData.splice(index, 1, Object.assign({}, row))
this.$message({ this.$message({
...@@ -140,7 +141,7 @@ ...@@ -140,7 +141,7 @@
* @param done 为表单关闭函数 * @param done 为表单关闭函数
* *
**/ **/
handleSave: function(row, done) { handleSave: function (row, done) {
addObj(row).then(data => { addObj(row).then(data => {
this.tableData.push(Object.assign({}, row)) this.tableData.push(Object.assign({}, row))
this.$message({ this.$message({
......
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
icon="el-icon-delete" icon="el-icon-delete"
size="small" size="small"
plain plain
@click="handleDel(scope.row,scope.index)">删除</el-button> @click="handleDel(scope.row,scope.index)">删除
</el-button>
</template> </template>
</avue-crud> </avue-crud>
</basic-container> </basic-container>
...@@ -44,121 +45,121 @@ ...@@ -44,121 +45,121 @@
</template> </template>
<script> <script>
import { fetchList, addObj, putObj, delObj } from '@/api/daemon/status-trace-log' import {addObj, delObj, fetchList, putObj} from '@/api/daemon/status-trace-log'
import { tableOption } from '@/const/crud/daemon/status-trace-log' import {tableOption} from '@/const/crud/daemon/status-trace-log'
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
export default {
name: 'status-trace-log', export default {
data () { name: 'status-trace-log',
return { data() {
tableData: [], return {
page: { tableData: [],
total: 0, // 总页数 page: {
currentPage: 1, // 当前页数 total: 0, // 总页数
pageSize: 20 // 每页显示多少条 currentPage: 1, // 当前页数
}, pageSize: 20 // 每页显示多少条
tableLoading: false, },
tableOption: tableOption tableLoading: false,
} tableOption: tableOption
}, }
created () {
},
mounted: function () { },
computed: {
...mapGetters(['permissions'])
},
methods: {
getList (page,params) {
this.tableLoading = true
fetchList(Object.assign({
current: page.currentPage,
size: page.pageSize
}, params)).then(response => {
this.tableData = response.data.data.records
this.page.total = response.data.data.total
this.tableLoading = false
})
}, },
/** created() {
* @title 打开新增窗口
* @detail 调用crud的handleadd方法即可
*
**/
handleAdd: function () {
this.$refs.crud.rowAdd()
}, },
handleEdit (row, index) { mounted: function () {
this.$refs.crud.rowEdit(row, index)
}, },
handleDel (row, index) { computed: {
this.$refs.crud.rowDel(row, index) ...mapGetters(['permissions'])
}, },
rowDel: function (row, index) { methods: {
var _this = this getList(page, params) {
this.$confirm('是否确认删除ID为' + row.clientId, '提示', { this.tableLoading = true
confirmButtonText: '确定', fetchList(Object.assign({
cancelButtonText: '取消', current: page.currentPage,
type: 'warning' size: page.pageSize
}) }, params)).then(response => {
.then(function () { this.tableData = response.data.data.records
return delObj(row.clientId) this.page.total = response.data.data.total
this.tableLoading = false
}) })
.then(() => { },
/**
* @title 打开新增窗口
* @detail 调用crud的handleadd方法即可
*
**/
handleAdd: function () {
this.$refs.crud.rowAdd()
},
handleEdit(row, index) {
this.$refs.crud.rowEdit(row, index)
},
handleDel(row, index) {
this.$refs.crud.rowDel(row, index)
},
rowDel: function (row, index) {
var _this = this
this.$confirm('是否确认删除ID为' + row.clientId, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
return delObj(row.clientId)
}).then(() => {
_this.tableData.splice(index, 1) _this.tableData.splice(index, 1)
_this.$message({ _this.$message({
showClose: true, showClose: true,
message: '删除成功', message: '删除成功',
type: 'success' type: 'success'
}) })
}).catch(function () {
}) })
.catch(function () { }) },
}, /**
/** * @title 数据更新
* @title 数据更新 * @param row 为当前的数据
* @param row 为当前的数据 * @param index 为当前更新数据的行数
* @param index 为当前更新数据的行数 * @param done 为表单关闭函数
* @param done 为表单关闭函数 *
* **/
**/ handleUpdate: function (row, index, done) {
handleUpdate: function (row, index, done) { putObj(row).then(() => {
putObj(row).then(() => { this.tableData.splice(index, 1, Object.assign({}, row))
this.tableData.splice(index, 1, Object.assign({}, row)) this.$message({
this.$message({ showClose: true,
showClose: true, message: '修改成功',
message: '修改成功', type: 'success'
type: 'success' })
done()
}) })
done() },
}) /**
}, * @title 数据添加
/** * @param row 为当前的数据
* @title 数据添加 * @param done 为表单关闭函数
* @param row 为当前的数据 *
* @param done 为表单关闭函数 **/
* handleSave: function (row, done) {
**/ addObj(row).then(() => {
handleSave: function (row, done) { this.tableData.push(Object.assign({}, row))
addObj(row).then(() => { this.$message({
this.tableData.push(Object.assign({}, row)) showClose: true,
this.$message({ message: '添加成功',
showClose: true, type: 'success'
message: '添加成功', })
type: 'success' done()
}) })
done() },
}) searchChange(form) {
}, this.getList(this.page, form)
searchChange (form) { },
this.getList(this.page,form) /**
}, * 刷新回调
/** */
* 刷新回调 refreshChange() {
*/ this.getList(this.page)
refreshChange () { }
this.getList(this.page)
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -29,24 +29,25 @@ ...@@ -29,24 +29,25 @@
</template> </template>
<script> <script>
import { mapGetters } from "vuex"; import {mapGetters} from "vuex";
export default { export default {
name: "dashboard", name: "dashboard",
computed: { computed: {
...mapGetters(["name", "roles"]) ...mapGetters(["name", "roles"])
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
.dashboard { .dashboard {
&-container { &-container {
margin: 30px; margin: 30px;
} }
&-text {
font-size: 30px; &-text {
line-height: 46px; font-size: 30px;
line-height: 46px;
}
} }
}
</style> </style>
...@@ -29,10 +29,12 @@ ...@@ -29,10 +29,12 @@
<template slot-scope="scope" <template slot-scope="scope"
slot="menu"> slot="menu">
<el-button type="text" <el-button type="text"
v-if="permissions.sys_client_del"
icon="el-icon-check" icon="el-icon-check"
size="mini" size="mini"
plain plain
@click="handleDown(scope.row,scope.index)">生成</el-button> @click="handleDown(scope.row,scope.index)">生成
</el-button>
</template> </template>
</avue-crud> </avue-crud>
...@@ -53,64 +55,66 @@ ...@@ -53,64 +55,66 @@
</template> </template>
<script> <script>
import { fetchList, handleDown } from '@/api/gen/gen' import {fetchList, handleDown} from '@/api/gen/gen'
import { tableOption, formOption } from '@/const/crud/gen/gen' import {formOption, tableOption} from '@/const/crud/gen/gen'
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
export default {
name: 'code-generator', export default {
data () { name: 'client',
return { data() {
tableData: [], return {
formData: {}, tableData: [],
box: false, formData: {},
page: { box: false,
total: 0, // 总页数 page: {
currentPage: 1, // 当前页数 total: 0, // 总页数
pageSize: 20 // 每页显示多少条 currentPage: 1, // 当前页数
}, pageSize: 20 // 每页显示多少条
tableLoading: false, },
tableOption: tableOption, tableLoading: false,
formOption: formOption tableOption: tableOption,
} formOption: formOption
}, }
created () {
},
mounted: function () { },
computed: {
...mapGetters(['permissions'])
},
methods: {
getList (page,params) {
this.tableLoading = true
fetchList(Object.assign({
current: page.currentPage,
size: page.pageSize
}, params)).then(response => {
this.tableData = response.data.data.records
this.page.total = response.data.data.total
this.tableLoading = false
})
}, },
handleDown: function (row, index) { created() {
this.formData.tableName = row.tableName
this.box = true
}, },
/** mounted: function () {
* 刷新回调
*/
refreshChange () {
this.getList(this.page)
}, },
searchChange (form) { computed: {
this.getList(this.page,form) ...mapGetters(['permissions'])
}, },
gen (form) { methods: {
handleDown(this.formData).then(response => { getList(page, params) {
this.tableLoading = true
fetchList(Object.assign({
current: page.currentPage,
size: page.pageSize
}, params)).then(response => {
this.tableData = response.data.data.records
this.page.total = response.data.data.total
this.tableLoading = false
})
},
handleDown: function (row, index) {
this.formData.tableName = row.tableName
this.box = true this.box = true
}) },
/**
* 刷新回调
*/
refreshChange() {
this.getList(this.page)
},
searchChange(form) {
this.getList(this.page, form)
},
gen(form) {
handleDown(this.formData).then(() => {
this.box = true
})
}
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -19,43 +19,44 @@ ...@@ -19,43 +19,44 @@
<div class="execution"> <div class="execution">
<basic-container> <basic-container>
<avue-crud :data="data" <avue-crud :data="data"
:option="option" /> :option="option"/>
</basic-container> </basic-container>
</div> </div>
</template> </template>
<script> <script>
import request from '@/router/axios' import request from '@/router/axios'
export default {
data () { export default {
return { data() {
obj: {}, return {
data: [], obj: {},
option: { data: [],
menu: false, option: {
page: false, menu: false,
addBtn: false, page: false,
align: 'center', addBtn: false,
menuAlign: 'center', align: 'center',
column: [ menuAlign: 'center',
{ column: [
label: '属性名称', {
prop: 'key' label: '属性名称',
}, prop: 'key'
{ },
label: '属性值', {
prop: 'value' label: '属性值',
} prop: 'value'
] }
]
}
} }
},
created() {
request({
url: '/tx/admin/avueSetting',
method: 'get'
}).then((resp) => {
this.data = resp.data
})
} }
},
created () {
request({
url: '/tx/admin/avueSetting',
method: 'get'
}).then((resp) => {
this.data = resp.data
})
} }
}
</script> </script>
...@@ -23,46 +23,47 @@ ...@@ -23,46 +23,47 @@
</div> </div>
</template> </template>
<script> <script>
import request from '@/router/axios' import request from '@/router/axios'
export default {
data() { export default {
return { data() {
obj: {}, return {
data: [], obj: {},
option: { data: [],
menu: false, option: {
page: false, menu: false,
addBtn: false, page: false,
align: 'center', addBtn: false,
menuAlign: 'center', align: 'center',
column: [ menuAlign: 'center',
{ column: [
label: '模块名称', {
prop: 'model' label: '模块名称',
}, prop: 'model'
{ },
label: '唯一标示', {
prop: 'uniqueKey' label: '唯一标示',
}, prop: 'uniqueKey'
{ },
label: '模块地址', {
prop: 'ipAddress' label: '模块地址',
}, prop: 'ipAddress'
{ },
label: '管道名称', {
prop: 'channelName' label: '管道名称',
} prop: 'channelName'
] }
]
}
} }
},
created() {
request({
url: '/tx/admin/onlines',
method: 'get'
}).then((resp) => {
this.data = resp.data
})
} }
},
created() {
request({
url: '/tx/admin/onlines',
method: 'get'
}).then((resp) => {
this.data = resp.data
})
} }
}
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment