Merge branch 'cool-team-official:5.x' into 5.x

This commit is contained in:
zhisenyang 2022-06-23 04:14:02 +08:00 committed by GitHub
commit 18d484bbee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 386 additions and 198 deletions

File diff suppressed because one or more lines are too long

View File

@ -491,6 +491,204 @@ declare interface BaseSysUser {
};
}
declare interface ChatChat {
/**
* list
* @returns Promise<any>
*/
list(data?: any): Promise<any>;
/**
* page
* @returns Promise<PageResponse>
*/
page(data?: any): Promise<PageResponse>;
/**
* info
* @returns Promise<any>
*/
info(data?: any): Promise<any>;
/**
* update
* @returns Promise<any>
*/
update(data?: any): Promise<any>;
/**
* delete
* @returns Promise<any>
*/
delete(data?: any): Promise<any>;
/**
* add
* @returns Promise<any>
*/
add(data?: any): Promise<any>;
/**
* getChatChannelUser
* @returns Promise<any>
*/
getChatChannelUser(data?: any): Promise<any>;
/**
* checkingSetReply
* @returns Promise<any>
*/
checkingSetReply(data?: any): Promise<any>;
/**
* changePrincipal
* @returns Promise<any>
*/
changePrincipal(data?: any): Promise<any>;
/**
* getChatMsgPage
* @returns Promise<any>
*/
getChatMsgPage(data?: any): Promise<any>;
/**
* leaveHelper
* @returns Promise<any>
*/
leaveHelper(data?: any): Promise<any>;
/**
* addHelper
* @returns Promise<any>
*/
addHelper(data?: any): Promise<any>;
/**
* setBlack
* @returns Promise<any>
*/
setBlack(data?: any): Promise<any>;
/**
* setReply
* @returns Promise<any>
*/
setReply(data?: any): Promise<any>;
/**
* setWork
* @returns Promise<any>
*/
setWork(data?: any): Promise<any>;
/**
* setStar
* @returns Promise<any>
*/
setStar(data?: any): Promise<any>;
/**
* inChat
* @returns Promise<any>
*/
inChat(data?: any): Promise<any>;
/**
*
*/
permission: {
list: string;
page: string;
info: string;
update: string;
delete: string;
add: string;
getChatChannelUser: string;
checkingSetReply: string;
changePrincipal: string;
getChatMsgPage: string;
leaveHelper: string;
addHelper: string;
setBlack: string;
setReply: string;
setWork: string;
setStar: string;
inChat: string;
};
}
declare interface ChatMessage {
/**
* list
* @returns Promise<any>
*/
list(data?: any): Promise<any>;
/**
* page
* @returns Promise<PageResponse>
*/
page(data?: any): Promise<PageResponse>;
/**
* info
* @returns Promise<any>
*/
info(data?: any): Promise<any>;
/**
* update
* @returns Promise<any>
*/
update(data?: any): Promise<any>;
/**
* delete
* @returns Promise<any>
*/
delete(data?: any): Promise<any>;
/**
* add
* @returns Promise<any>
*/
add(data?: any): Promise<any>;
/**
*
*/
permission: {
list: string;
page: string;
info: string;
update: string;
delete: string;
add: string;
};
}
declare interface ChatSession {
/**
* list
* @returns Promise<any>
*/
list(data?: any): Promise<any>;
/**
* page
* @returns Promise<PageResponse>
*/
page(data?: any): Promise<PageResponse>;
/**
* info
* @returns Promise<any>
*/
info(data?: any): Promise<any>;
/**
* update
* @returns Promise<any>
*/
update(data?: any): Promise<any>;
/**
* delete
* @returns Promise<any>
*/
delete(data?: any): Promise<any>;
/**
* add
* @returns Promise<any>
*/
add(data?: any): Promise<any>;
/**
*
*/
permission: {
list: string;
page: string;
info: string;
update: string;
delete: string;
add: string;
};
}
declare interface DemoGoods {
/**
* list
@ -2005,94 +2203,6 @@ declare interface TaskInfo {
};
}
declare interface ChatMessage {
/**
* list
* @returns Promise<any>
*/
list(data?: any): Promise<any>;
/**
* page
* @returns Promise<PageResponse>
*/
page(data?: any): Promise<PageResponse>;
/**
* info
* @returns Promise<any>
*/
info(data?: any): Promise<any>;
/**
* update
* @returns Promise<any>
*/
update(data?: any): Promise<any>;
/**
* delete
* @returns Promise<any>
*/
delete(data?: any): Promise<any>;
/**
* add
* @returns Promise<any>
*/
add(data?: any): Promise<any>;
/**
*
*/
permission: {
list: string;
page: string;
info: string;
update: string;
delete: string;
add: string;
};
}
declare interface ChatSession {
/**
* list
* @returns Promise<any>
*/
list(data?: any): Promise<any>;
/**
* page
* @returns Promise<PageResponse>
*/
page(data?: any): Promise<PageResponse>;
/**
* info
* @returns Promise<any>
*/
info(data?: any): Promise<any>;
/**
* update
* @returns Promise<any>
*/
update(data?: any): Promise<any>;
/**
* delete
* @returns Promise<any>
*/
delete(data?: any): Promise<any>;
/**
* add
* @returns Promise<any>
*/
add(data?: any): Promise<any>;
/**
*
*/
permission: {
list: string;
page: string;
info: string;
update: string;
delete: string;
add: string;
};
}
declare interface Test {
/**
* list
@ -2151,6 +2261,7 @@ declare type Service = {
user: BaseSysUser;
};
};
chat: { chat: ChatChat; message: ChatMessage; session: ChatSession };
demo: { goods: DemoGoods };
fbMall: {
account: FbMallAccount;
@ -2187,6 +2298,5 @@ declare type Service = {
warehouse: SysWarehouse;
};
task: { info: TaskInfo };
chat: { message: ChatMessage; session: ChatSession };
test: Test;
};

View File

@ -1,6 +1,6 @@
{
"name": "front-next",
"version": "5.3.0",
"version": "5.4.1",
"scripts": {
"dev": "vite --host",
"build": "vite build",
@ -9,7 +9,7 @@
"lint:eslint": "eslint \"{src,mock}/**/*.{vue,ts,tsx}\" --fix"
},
"dependencies": {
"@cool-vue/crud": "^5.0.13",
"@cool-vue/crud": "^5.2.2",
"@element-plus/icons-vue": "^1.1.3",
"@vueuse/core": "^8.2.5",
"axios": "^0.27.2",

View File

@ -119,15 +119,16 @@ axios.interceptors.response.use(
if (error.response) {
const { status, config } = error.response;
const { user } = useBase();
if (status == 401) {
user.logout();
}
if (isDev) {
ElMessage.error(`${config.url} ${status}`);
} else {
switch (status) {
case 401:
router.href("401");
break;
case 403:
router.href("403");
break;

View File

@ -0,0 +1,136 @@
<template>
<div class="cl-column-custom__wrap">
<el-button @click="open">自定义列</el-button>
<cl-dialog v-model="visible" title="自定义列">
<div class="cl-column-custom__dialog">
<div class="left">
<el-checkbox-group v-model="selection">
<el-checkbox
v-for="(item, index) in list"
:key="index"
:label="item.value"
>{{ item.label }}</el-checkbox
>
</el-checkbox-group>
</div>
<div class="right"></div>
</div>
<template #footer>
<el-button @click="close">取消</el-button>
<el-button type="success" @click="save">保存</el-button>
</template>
</cl-dialog>
</div>
</template>
<script lang="ts">
import { computed, defineComponent, onMounted, ref } from "vue";
import { useCrud } from "@cool-vue/crud";
import store from "store";
export default defineComponent({
name: "cl-column-custom",
props: {
name: String,
columns: {
type: Array,
default: () => []
}
},
setup(props) {
// cl-crud
const Crud = useCrud();
//
const visible = ref(false);
//
const selection = ref([]);
//
const name = `column-custom__${props.name || location.pathname}`;
//
const list = computed(() => {
return props.columns
.filter((e: any) => !e.type)
.map((e: any) => {
return {
label: e.label,
value: e.prop
};
});
});
// prop
function getNames() {
const arr = store.get(name);
return arr ? arr : list.value.map((e) => e.value);
}
//
function change() {
const names = getNames();
if (store.get(name)) {
Crud.value?.Table.reBuild(() => {
props.columns.map((e: any) => {
if (!e.type) {
e.hidden = !names.includes(e.prop);
}
});
});
}
}
//
function save() {
store.set(name, selection.value);
change();
close();
}
//
function open() {
selection.value = getNames();
visible.value = true;
}
//
function close() {
visible.value = false;
}
onMounted(() => {
change();
});
return {
visible,
list,
selection,
open,
close,
save
};
}
});
</script>
<style lang="scss" scoped>
.cl-column-custom {
&__dialog {
.left {
}
.right {
border-left: 1px solid #eee;
}
}
}
</style>

View File

@ -59,7 +59,7 @@ import { useCool } from "/@/cool";
import RouteNav from "./route-nav.vue";
import AMenu from "./amenu.vue";
const { router } = useCool();
const { router, service } = useCool();
const { user, app } = useBase();
//
@ -69,6 +69,7 @@ function onCommand(name: string) {
router.push("/my/info");
break;
case "exit":
service.base.comm.logout();
user.logout();
break;
}

View File

@ -76,10 +76,6 @@ export const useUserStore = defineStore("user", function () {
// 退出
async function logout() {
try {
await service.base.comm.logout();
} catch {}
clear();
router.href("login");
}

View File

@ -176,7 +176,9 @@ async function refresh() {
}
provide("chat", {
socket,
get socket() {
return socket;
},
send,
scrollToBottom
});

View File

@ -4,12 +4,10 @@
<el-row>
<cl-refresh-btn />
<cl-add-btn />
<el-button @click="openForm">Open Form</el-button>
<cl-filter label="状态">
<el-select></el-select>
</cl-filter>
<el-button @click="openForm">自定义表单</el-button>
<cl-flex1></cl-flex1>
<cl-column-custom :columns="Table?.columns" />
<cl-filter-group :items="filter.items"></cl-filter-group>
</el-row>
@ -63,10 +61,7 @@ const Upsert = useUpsert({
prop: "name",
required: true,
component: {
name: "el-input",
props: {
type: "textarea"
}
name: "el-input"
}
},
{
@ -85,10 +80,19 @@ const Upsert = useUpsert({
}
},
{
label: "crud",
label: "内嵌Crud",
group: "1",
component: {
name: "slot-crud"
}
},
{
label: "年龄",
group: "2",
prop: "age",
component: {
name: "el-input-number"
}
}
],
onInfo(data, { next, close, done }) {
@ -134,6 +138,10 @@ const Table = useTable({
}
]
},
{
label: "创建时间",
prop: "createTime"
},
{
type: "op",
buttons: ["edit", "delete"]
@ -150,7 +158,7 @@ const filter = {
},
items: [
{
label: "A",
label: "关键字",
prop: "keyWord",
component: {
name: "el-input",
@ -177,7 +185,7 @@ const Crud2 = useCrud(
const Table2 = useTable({
columns: [
{
label: "姓名2",
label: "姓名",
prop: "name"
},
{
@ -220,10 +228,10 @@ const AdvSearch = useAdvSearch({
function openForm() {
Form.value?.open({
title: "自定义4",
title: "自定义表单",
items: [
{
label: "name",
label: "姓名",
prop: "name",
required: true,
component: {

View File

@ -16,9 +16,8 @@
<script lang="ts">
import { useCrud } from "@cool-vue/crud";
import { defineComponent, inject, ref } from "vue";
import { defineComponent, ref } from "vue";
import { currentDate, export_json_to_excel } from "../utils";
import { service } from "../../../cool/service/index";
export default defineComponent({
name: "cl-export-btn",
@ -40,10 +39,7 @@ export default defineComponent({
},
data: [Function, Array],
maxExportLimit: Number, // 0
size: {
type: String,
default: "mini"
},
size: String,
disabled: Boolean,
type: String,
plain: Boolean,
@ -57,9 +53,7 @@ export default defineComponent({
const Crud = useCrud();
async function getHeader(columns: any[], fields: any[]) {
return (
props.header || columns.filter((e) => fields.includes(e.prop)).map((e) => e.label)
);
return columns.filter((e) => !e.hidden && fields.includes(e.prop)).map((e) => e.label);
}
function getData() {
@ -122,8 +116,12 @@ export default defineComponent({
//
const columns = props.columns.filter(
(e: any) =>
!["selection", "expand", "index"].includes(e.type) &&
!(e.filterExport || e["filter-export"])
!(
e.hidden === true ||
["selection", "expand", "index"].includes(e.type) ||
e.filterExport ||
e["filter-export"]
)
);
//

View File

@ -984,14 +984,14 @@
"@babel/helper-validator-identifier" "^7.16.7"
to-fast-properties "^2.0.0"
"@cool-vue/crud@^5.0.13":
version "5.0.13"
resolved "https://registry.npmjs.org/@cool-vue/crud/-/crud-5.0.13.tgz#6fe3dc2b0660ea5ccfa8a7420af97972de3887ec"
integrity sha512-yzzYWAlUKnOiJKX7+OQZgD39xXCyQCcuOWdp8foMWIWdUaWyHTxK3aFDd+V4EuK+T8lWbG+HggE784fKTxZJRQ==
"@cool-vue/crud@^5.2.2":
version "5.2.2"
resolved "https://registry.npmjs.org/@cool-vue/crud/-/crud-5.2.2.tgz#7387343d23066ee4d5b441f4f05f413bff50b6d8"
integrity sha512-u+NCjUIap2g4H+tapzBVGRqRdMqUDDFDhWHsatiLu2KgYPG7THvMhmcf1jkPaa24vImBsB1yKPG63lweL5kzjw==
dependencies:
array.prototype.flat "^1.2.4"
core-js "^3.21.1"
element-plus "^2.2.0"
element-plus "^2.2.5"
merge "^2.1.1"
mitt "^3.0.0"
vue "^3.2.31"
@ -1001,7 +1001,7 @@
resolved "https://registry.npmjs.org/@ctrl/tinycolor/-/tinycolor-3.4.1.tgz#75b4c27948c81e88ccd3a8902047bcd797f38d32"
integrity sha512-ej5oVy6lykXsvieQtqZxCOaLT+xD4+QNarq78cIYISHmZXshCvROLudpQN3lfL8G0NL7plMSSK+zlyvCaIJ4Iw==
"@element-plus/icons-vue@^1.1.3", "@element-plus/icons-vue@^1.1.4":
"@element-plus/icons-vue@^1.1.3":
version "1.1.4"
resolved "https://registry.npmjs.org/@element-plus/icons-vue/-/icons-vue-1.1.4.tgz#5d2788ea356f1458068e6d400e724ca5f3d29aca"
integrity sha512-Iz/nHqdp1sFPmdzRwHkEQQA3lKvoObk8azgABZ81QUOpW9s/lUyQVUSh0tNtEPZXQlKwlSh7SPgoVxzrE0uuVQ==
@ -1026,23 +1026,11 @@
minimatch "^3.0.4"
strip-json-comments "^3.1.1"
"@floating-ui/core@^0.6.2":
version "0.6.2"
resolved "https://registry.npmjs.org/@floating-ui/core/-/core-0.6.2.tgz#f2813f0e5f3d5ed7af5029e1a082203dadf02b7d"
integrity sha512-jktYRmZwmau63adUG3GKOAVCofBXkk55S/zQ94XOorAHhwqFIOFAy1rSp2N0Wp6/tGbe9V3u/ExlGZypyY17rg==
"@floating-ui/core@^0.7.3":
version "0.7.3"
resolved "https://registry.npmjs.org/@floating-ui/core/-/core-0.7.3.tgz#d274116678ffae87f6b60e90f88cc4083eefab86"
integrity sha512-buc8BXHmG9l82+OQXOFU3Kr2XQx9ys01U/Q9HMIrZ300iLc8HLMgh7dcCqgYzAzf4BkoQvDcXf5Y+CuEZ5JBYg==
"@floating-ui/dom@^0.4.5":
version "0.4.5"
resolved "https://registry.npmjs.org/@floating-ui/dom/-/dom-0.4.5.tgz#2e88d16646119cc67d44683f75ee99840475bbfa"
integrity sha512-b+prvQgJt8pieaKYMSJBXHxX/DYwdLsAWxKYqnO5dO2V4oo/TYBZJAUQCVNjTWWsrs6o4VDrNcP9+E70HAhJdw==
dependencies:
"@floating-ui/core" "^0.6.2"
"@floating-ui/dom@^0.5.2":
version "0.5.3"
resolved "https://registry.npmjs.org/@floating-ui/dom/-/dom-0.5.3.tgz#ade192cf9a911fc3e95fb614fe281658b654043c"
@ -1144,7 +1132,7 @@
resolved "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.21.tgz#5de5a2385a35309427f6011992b544514d559aa1"
integrity sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==
"@popperjs/core@npm:@sxzz/popperjs-es@^2.11.6", "@popperjs/core@npm:@sxzz/popperjs-es@^2.11.7":
"@popperjs/core@npm:@sxzz/popperjs-es@^2.11.7":
version "2.11.7"
resolved "https://registry.npmjs.org/@sxzz/popperjs-es/-/popperjs-es-2.11.7.tgz#a7f69e3665d3da9b115f9e71671dae1b97e13671"
integrity sha512-Ccy0NlLkzr0Ex2FKvh2X+OyERHXJ88XJ1MXtsI9y9fGexlaXaVTPzBCRBwIxFkORuOb+uBqeu+RqnpgYTEZRUQ==
@ -1820,15 +1808,6 @@
"@vueuse/shared" "8.2.5"
vue-demi "*"
"@vueuse/core@^8.2.6":
version "8.4.2"
resolved "https://registry.npmjs.org/@vueuse/core/-/core-8.4.2.tgz#e5be73f40394150e6a1b6abd59e5adb7c6bb6c1f"
integrity sha512-dUVU96lii1ZdWoNJXauQNt+4QrHz1DKbuW+y6pDR2N10q7rGZJMDU7pQeMcC2XeosX7kMODfaBuqsF03NozzLg==
dependencies:
"@vueuse/metadata" "8.4.2"
"@vueuse/shared" "8.4.2"
vue-demi "*"
"@vueuse/core@^8.6.0":
version "8.6.0"
resolved "https://registry.npmjs.org/@vueuse/core/-/core-8.6.0.tgz#a8f80363cc63d17382423f16beae57696f376e67"
@ -1843,11 +1822,6 @@
resolved "https://registry.npmjs.org/@vueuse/metadata/-/metadata-8.2.5.tgz#51c7d95e04284ea378a5242a2e88b77494e2c117"
integrity sha512-Lk9plJjh9cIdiRdcj16dau+2LANxIdFCiTgdfzwYXbflxq0QnMBeOD2qHgKDE7fuVrtPcVWj8VSuZEx1HRfNQA==
"@vueuse/metadata@8.4.2":
version "8.4.2"
resolved "https://registry.npmjs.org/@vueuse/metadata/-/metadata-8.4.2.tgz#b33e6b7bd5ca69e3f24ea41b149267118bcd566f"
integrity sha512-2BIj++7P0/I5dfMsEe8q7Kw0HqVAjVcyNOd9+G22/ILUC9TVLTeYOuJ1kwa1Gpr+0LWKHc6GqHiLWNL33+exoQ==
"@vueuse/metadata@8.6.0":
version "8.6.0"
resolved "https://registry.npmjs.org/@vueuse/metadata/-/metadata-8.6.0.tgz#34771443a72ee891ae001a70aa05dd9a1d799372"
@ -1860,13 +1834,6 @@
dependencies:
vue-demi "*"
"@vueuse/shared@8.4.2":
version "8.4.2"
resolved "https://registry.npmjs.org/@vueuse/shared/-/shared-8.4.2.tgz#5900f06ff78bd8b6df4cbf48f8ca82dd6d9747d1"
integrity sha512-hILXMEjL8YQhj1LHN/HZ49UThyfk8irTjhele2nW+L3N55ElFUBGB/f4w0rg8EW+/suhqv7kJJPTZzvHCqxlIw==
dependencies:
vue-demi "*"
"@vueuse/shared@8.6.0":
version "8.6.0"
resolved "https://registry.npmjs.org/@vueuse/shared/-/shared-8.6.0.tgz#63dad9fc4b73a7fccbe5d6b97adeacf73d4fec41"
@ -2162,11 +2129,6 @@ astral-regex@^2.0.0:
resolved "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31"
integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==
async-validator@^4.0.7:
version "4.0.7"
resolved "https://registry.npmjs.org/async-validator/-/async-validator-4.0.7.tgz#034a0fd2103a6b2ebf010da75183bec299247afe"
integrity sha512-Pj2IR7u8hmUEDOwB++su6baaRi+QvsgajuFB9j95foM1N2gy5HM4z60hfusIO0fBPG5uLAEl6yCJr1jNSVugEQ==
async-validator@^4.1.1:
version "4.1.1"
resolved "https://registry.npmjs.org/async-validator/-/async-validator-4.1.1.tgz#3cd1437faa2de64743f7d56649dd904c946a18fe"
@ -2786,11 +2748,6 @@ csstype@^2.6.8:
resolved "https://registry.npmjs.org/csstype/-/csstype-2.6.20.tgz#9229c65ea0b260cf4d3d997cb06288e36a8d6dda"
integrity sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA==
dayjs@^1.11.1:
version "1.11.2"
resolved "https://registry.npmjs.org/dayjs/-/dayjs-1.11.2.tgz#fa0f5223ef0d6724b3d8327134890cfe3d72fbe5"
integrity sha512-F4LXf1OeU9hrSYRPTTj/6FbO4HTjPKXvEIC1P2kcnFurViINCVk3ZV0xAS3XVx9MkMsXbbqlK6hjseaYbgKEHw==
dayjs@^1.11.3:
version "1.11.3"
resolved "https://registry.npmjs.org/dayjs/-/dayjs-1.11.3.tgz#4754eb694a624057b9ad2224b67b15d552589258"
@ -3016,27 +2973,6 @@ electron-to-chromium@^1.4.84:
resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.107.tgz#564257014ab14033b4403a309c813123c58a3fb9"
integrity sha512-Huen6taaVrUrSy8o7mGStByba8PfOWWluHNxSHGBrCgEdFVLtvdQDBr9LBCF9Uci8SYxh28QNNMO0oC17wbGAg==
element-plus@^2.2.0:
version "2.2.0"
resolved "https://registry.npmjs.org/element-plus/-/element-plus-2.2.0.tgz#58467d1efde071c2bc12caa9fb451e515667fc78"
integrity sha512-zxmAFEAa1T/n09rR+NozXcWl5CjaFtqoaxhFSafag0dgc90tgEHitDXfegdFAl4ahugdNTqu9aLzngx3VhDAtA==
dependencies:
"@ctrl/tinycolor" "^3.4.1"
"@element-plus/icons-vue" "^1.1.4"
"@floating-ui/dom" "^0.4.5"
"@popperjs/core" "npm:@sxzz/popperjs-es@^2.11.6"
"@types/lodash" "^4.14.182"
"@types/lodash-es" "^4.17.6"
"@vueuse/core" "^8.2.6"
async-validator "^4.0.7"
dayjs "^1.11.1"
escape-html "^1.0.3"
lodash "^4.17.21"
lodash-es "^4.17.21"
lodash-unified "^1.0.2"
memoize-one "^6.0.0"
normalize-wheel-es "^1.1.2"
element-plus@^2.2.5:
version "2.2.5"
resolved "https://registry.npmjs.org/element-plus/-/element-plus-2.2.5.tgz#2bb889660c9bcb9bb71e18619915b35e0f48d569"