Skip to content

Commit

Permalink
perf(someChange): 代码优化,移除animated.css,watermark
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Sep 24, 2020
1 parent e375d6d commit 209ce39
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 172 deletions.
6 changes: 1 addition & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Vue from 'vue';
import lodash from 'lodash';
import PinyinMatch from 'pinyin-match';// 拼音匹配
import dayjs from 'dayjs';
import animated from 'animate.css';
import CrudTable from '@/components/CrudTable/CrudTable.vue'; // 全局注册用于增删改查的高级表格组件
import axios from '@/plugins/axios';// axios中统一设置Token
import store from '@/store/index';// store内做了局部持久化
Expand All @@ -21,8 +20,6 @@ import '@/permission'; // 权限控制
import '@/styles/index.scss'; // 全局样式
import '@/icons/autoImportSvg'; // 自动导入src/icon目录下的svg图标

Vue.use(animated);

Vue.component('CrudTable', CrudTable); // 全局注册用于增删改查的高级表格组件

/* 这里改写原型链,将axios设置为Vue的原型属性,
Expand All @@ -38,8 +35,7 @@ Vue.prototype.dayjs = dayjs;
Vue.config.productionTip = false;
// 拼音匹配插件
Vue.prototype.$pinyinmatch = PinyinMatch;
// 挂载EventBus
Vue.prototype.$EventBus = new Vue();

new Vue({
router,
store,
Expand Down
9 changes: 0 additions & 9 deletions src/permission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* @createDate 2018年11月13日10:58:43
*/

import dayjs from 'dayjs';
import Watermark from '@/plugins/watermark';
import { router } from './router';
import store from './store';
// 白名单:不需要鉴权的地址
Expand Down Expand Up @@ -42,10 +40,3 @@ router.beforeEach(async (to, from, next) => {
next('/login');
}
});

// 路由全局后置钩子,不接受next不改变导航
router.afterEach((to) => {
if ('/login,/404'.includes(to.path) === false) {
Watermark.set(store.getters.realname, dayjs().format('YYYY年MM月DD日'));
}
});
66 changes: 0 additions & 66 deletions src/plugins/watermark.ts

This file was deleted.

19 changes: 0 additions & 19 deletions src/shims-tsx.d.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/shims-vue-expand.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,17 @@
import VueRouter, { Route } from 'vue-router';

import { Store } from 'vuex';
import { ElMessage } from 'element-ui/types/message';

// 扩充
declare module 'vue/types/vue' {
interface Vue {
$router: VueRouter;
$route: Route;
$store: Store<any>;
$api: any;
$message:ElMessage
lodash:any;
axios:any;
dayjs:any;
$pinyinmatch:any;
$EventBus:any;
}
}

2 changes: 0 additions & 2 deletions src/shims-vue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@ declare module '*.vue' {

declare module 'vuedraggable';
declare module 'jsoneditor';
declare module 'animate.css';
declare module 'v-contextmenu';
19 changes: 0 additions & 19 deletions src/styles/variables.scss

This file was deleted.

82 changes: 42 additions & 40 deletions src/views/devTools/Dict.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,30 @@
highlight-current
:default-expanded-keys="['fe980574-2552-4754-88c8-366eb5a22861']"
@node-click="treeClick">
<span class="custom-tree-node"
slot-scope="{ node, data }">
<span>{{ node.label }}</span>
<span style="margin-left:8px">
<el-button type="text"
size="mini"
@click="() => add(data)">
添加
</el-button>
<el-button type="text"
size="mini"
@click="() => edit(data)">
修改
</el-button>
<el-button type="text"
size="mini"
v-if="data.parentId!=='0'"
@click="() => remove(data)">
删除
</el-button>

<template v-slot="{ node, data }">
<span class="custom-tree-node">
<span>{{ node.label }}</span>
<span style="margin-left:8px">
<el-button type="text"
size="mini"
@click="() => add(data)">
添加
</el-button>
<el-button type="text"
size="mini"
@click="() => edit(data)">
修改
</el-button>
<el-button type="text"
size="mini"
v-if="data.parentId!=='0'"
@click="() => remove(data)">
删除
</el-button>
</span>
</span>
</span>
</template>
</el-tree>
</el-col>
<el-col :span="19">
Expand All @@ -68,7 +70,7 @@

</el-row>
<el-dialog :title="textMap[dialogStatus]"
:visible.sync="dialogFormVisible"
v-model="dialogFormVisible"
width="80%">

<el-form ref="form"
Expand All @@ -86,17 +88,17 @@
</el-form-item>

</el-form>

<div slot="footer"
class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button v-if="dialogStatus=== 0 "
type="primary"
@click="save">新 增</el-button>
<el-button v-else
type="primary"
@click="save">修 改</el-button>
</div>
<template v-slot:footer>
<div class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button v-if="dialogStatus=== 0 "
type="primary"
@click="save">新 增</el-button>
<el-button v-else
type="primary"
@click="save">修 改</el-button>
</div>
</template>
</el-dialog>

</div>
Expand Down Expand Up @@ -156,25 +158,25 @@ export default {
};
},
methods: {
afterDropDown(node, end, position, event) {
afterDropDown(node, end, position) {
if (position === 'inner') {
const obj = node.data;
obj.parentId = end.data.id;
crud(DML.UPDATE, 'ad_codelist_type', obj).then((res) => {
crud(DML.UPDATE, 'ad_codelist_type', obj).then(() => {
this.$message.success('操作成功');
this.fetchDictType();
});
} else if (position === 'before') {
const obj = node.data;
obj.codeorder = Number(end.data.codeorder) - 1;
crud(DML.UPDATE, 'ad_codelist_type', obj).then((res) => {
crud(DML.UPDATE, 'ad_codelist_type', obj).then(() => {
this.$message.success('操作成功');
this.fetchDictType();
});
} else if (position === 'after') {
const obj = node.data;
obj.codeorder = Number(end.data.codeorder) + 1;
crud(DML.UPDATE, 'ad_codelist_type', obj).then((res) => {
crud(DML.UPDATE, 'ad_codelist_type', obj).then(() => {
this.$message.success('操作成功');
this.fetchDictType();
});
Expand All @@ -195,12 +197,12 @@ export default {
save() {
this.entity.codeValue = this.entity.codeName;
if (this.dialogStatus === STATUS.CREATE) {
crud(DML.INSERT, 'ad_codelist_type', this.entity).then((res) => {
crud(DML.INSERT, 'ad_codelist_type', this.entity).then(() => {
this.fetchDictType();
this.dialogFormVisible = false;
});
} else {
crud(DML.UPDATE, 'ad_codelist_type', this.entity).then((res) => {
crud(DML.UPDATE, 'ad_codelist_type', this.entity).then(() => {
this.fetchDictType();
this.dialogFormVisible = false;
});
Expand Down Expand Up @@ -234,7 +236,7 @@ export default {
this.$refs.codeListTable.tableReload();
},
// 树节点过滤
filterNode(value, data, node) {
filterNode(value, data) {
if (!value) return true;
return this.$pinyinmatch.match(data.codeName, value);
},
Expand Down
7 changes: 2 additions & 5 deletions src/views/devTools/FormDesigner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,17 @@
orderCondition="timestamp desc"
:btnEditOnClick="btnEditOnClick"
:btnAddOnClick="btnAddOnClick"
:searchFormCondition="searchFormParams"
fullHeight
:visibleList="{
tableTitle:false,
btnDel:true,
}">
<!-- 以后这里会改成form -->
<template slot="btnCustom"
slot-scope="scope">
<template #btnCustom="{row}">
<el-button slot="btnCustom"
type="primary"
size="mini"
@click="btnCopyOnClick(scope.row)">复制</el-button>
@click="btnCopyOnClick(row)">复制</el-button>
</template>
</CrudTable>
<FormDesignerDialog ref="dialog"
Expand All @@ -46,7 +44,6 @@ export default {
},
data() {
return {
searchFormParams: [{ key: 'tableName', operator: 'like', value: '' }],
remoteFuncs: {
getTablesOfDB(resolve) {
// 请求表名列表
Expand Down
2 changes: 0 additions & 2 deletions src/views/devTools/TableDesigner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
orderCondition="timestamp desc"
:btnEditOnClick="btnEditOnClick"
:btnAddOnClick="btnAddOnClick"
:searchFormCondition="searchFormParams"
fullHeight
:visibleList="{
tableTitle:false,
Expand Down Expand Up @@ -45,7 +44,6 @@ export default {
},
data() {
return {
searchFormParams: [{ key: 'tableName', operator: 'like', value: '' }],
remoteFuncs: {
getTablesOfDB(resolve) {
// 请求表名列表
Expand Down
2 changes: 1 addition & 1 deletion src/views/layout/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
:default-active="$route.path"
unique-opened
mode="vertical"
background-color="#ebeef5"
background-color="#e6edff"
text-color="#333"
active-text-color="#616dad"
class="menu"
Expand Down

0 comments on commit 209ce39

Please sign in to comment.