@leevan/jtui 2.0.33 → 2.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,134 @@
1
+ <template>
2
+ <el-popover
3
+ placement="bottom"
4
+ width="400"
5
+ popper-class="tree-select"
6
+ trigger="click">
7
+ <div class="tree-box">
8
+ <el-tree
9
+ ref="treeRef"
10
+ :props="props"
11
+ :load="loadNode"
12
+ node-key="id"
13
+ lazy
14
+ :check-strictly="isStrictly"
15
+ @check="onTreecheck"
16
+ show-checkbox>
17
+ </el-tree>
18
+ </div>
19
+
20
+ <div class="label-input" slot="reference">
21
+ <div class="tag-box">
22
+ <span v-if="value.length == 0" style="color:#b1b1b1">请选择</span>
23
+ <el-tag size="mini" type="info" v-for="(tag,index) in value.slice(0,1)" :key="index">{{ tag.name }}</el-tag>
24
+ <el-tag size="mini" type="info" v-if="value.length > 1">+ {{ value.length - 1 }}</el-tag>
25
+ <span v-if="value.length > 0" class="jtIcon iconguanbi1 guanbi-icon" @click="clearTree"></span>
26
+ </div>
27
+ </div>
28
+ </el-popover>
29
+ </template>
30
+
31
+ <script>
32
+ export default {
33
+ props:['activeType','value','checked','baseUrl'],
34
+ created(){
35
+ console.log(this.activeType.rootpath)
36
+ },
37
+ data(){
38
+ return {
39
+ props: {
40
+ label: 'name',
41
+ children: 'id',
42
+ isLeaf: 'leaf'
43
+ },
44
+ isStrictly: this.activeType.config.isStrictly || false
45
+ }
46
+ },
47
+ methods:{
48
+ async loadNode(node, resolve) {
49
+ console.log(node)
50
+ let childPath
51
+ if(node.level == 0){
52
+ childPath = this.activeType.rootpath
53
+ }else{
54
+ childPath = node.data.path
55
+ }
56
+ const {data} = await this.$axios.post(this.baseUrl + childPath,this.activeType.params);
57
+ for(let i of this.checked){
58
+ for(let c of data){
59
+ if(i.id == c.id){
60
+ setTimeout(() => {
61
+ this.$refs.treeRef.setChecked(i.id,true)
62
+ },100)
63
+ break;
64
+ }
65
+ }
66
+ }
67
+ resolve(data.map(item => {
68
+ item.leaf = item.path === '-' || !item.path
69
+ item.disabled = this.activeType.config.parentDisabled ? false : (item.path === '-' || !item.path ? false : true)
70
+ return item
71
+ }));
72
+ },
73
+ onTreecheck(data,treeInfo){
74
+ if(this.activeType.config.mode == 'radio'){
75
+ this.$refs.treeRef.setCheckedKeys([data.id]);
76
+ this.$emit('input',[data])
77
+ }else{
78
+ const checkNodes = this.$refs.treeRef.getCheckedNodes()
79
+ this.$emit('input',checkNodes)
80
+ }
81
+ },
82
+ clearTree(){
83
+ this.$emit('input',[])
84
+ this.$refs.treeRef.setCheckedKeys([]);
85
+ }
86
+ }
87
+ }
88
+ </script>
89
+
90
+ <style lang="scss" scoped>
91
+ .label-input{
92
+ min-height: 28px;
93
+ width:200px ;
94
+ border: 1px solid #DCDFE6;
95
+ border-radius: 4px;
96
+ background-color: #FFF;
97
+ display: flex;
98
+ align-items: center;
99
+ padding-left:15px;
100
+ position: relative;
101
+ }
102
+ .tag-box{
103
+ .guanbi-icon{
104
+ position: absolute;
105
+ right:10px;
106
+ top:6px;
107
+ color:#d0d0d0;
108
+ cursor: pointer;
109
+ }
110
+ }
111
+ .tree-box{
112
+ max-height:70vh;
113
+ overflow: auto;
114
+ padding:10px;
115
+ &::-webkit-scrollbar {
116
+ width: 10px;
117
+ height: 10px;
118
+ display: none;
119
+ }
120
+ &:hover::-webkit-scrollbar{
121
+ display: block;
122
+ }
123
+ &::-webkit-scrollbar-thumb {
124
+ border-radius: 10px;
125
+ background: #d0d0d0;
126
+ }
127
+ }
128
+ </style>
129
+
130
+ <style lang="scss">
131
+ .tree-select{
132
+ padding:0;
133
+ }
134
+ </style>
package/packages/index.js CHANGED
@@ -4,6 +4,7 @@ import JtFormPc from './jt-form-pc';
4
4
  import JtUploadPc from './jt-upload-pc';
5
5
  import JtEchartsPc from './jt-echarts-pc';
6
6
  import JtOrgtreePc from './jt-orgtree-pc'
7
+ import SearchType from './Search-Type/index.js';
7
8
 
8
9
  //vex-table样式
9
10
  import 'vxe-table/lib/index.css';
@@ -30,7 +31,8 @@ const components = [
30
31
  JtFormPc,
31
32
  JtUploadPc,
32
33
  JtEchartsPc,
33
- JtOrgtreePc
34
+ JtOrgtreePc,
35
+ SearchType
34
36
  ]
35
37
 
36
38
  // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,那么所有的组件都会被注册
@@ -54,5 +56,6 @@ export default {
54
56
  JtFormPc,
55
57
  JtUploadPc,
56
58
  JtEchartsPc,
57
- JtOrgtreePc
59
+ JtOrgtreePc,
60
+ SearchType
58
61
  }
@@ -1,3 +1,10 @@
1
+ /*
2
+ * @Author: leevan
3
+ * @Date: 2022-01-15 17:02:55
4
+ * @LastEditTime: 2024-04-21 14:31:38
5
+ * @LastEditors: leevan
6
+ * @FilePath: /jtui-pc/packages/jtaxios.js
7
+ */
1
8
  import axios from 'axios';
2
9
  import { Message } from 'element-ui';
3
10
  import { promises } from 'fs';
@@ -20,7 +27,6 @@ newAxios.interceptors.request.use(config=>{
20
27
  newAxios.interceptors.response.use(data=>{
21
28
  return data;
22
29
  },error=>{
23
- Nprogress.done();
24
30
  Message.error({
25
31
  message:'加载失败'
26
32
  })
package/vue.config.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: leevan
3
3
  * @Date: 2022-01-15 17:02:55
4
- * @LastEditTime: 2023-10-12 16:04:14
4
+ * @LastEditTime: 2024-04-21 13:27:28
5
5
  * @LastEditors: leevan
6
6
  * @FilePath: /jtui-pc/vue.config.js
7
7
  */