vue2-client 1.7.11 → 1.7.12

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.
@@ -1,210 +1,210 @@
1
- <template>
2
- <div>
3
- <a-input
4
- @click="inputClick"
5
- :value="valueView"
6
- style="cursor:pointer"
7
- readOnly/>
8
- <a-modal
9
- v-if="visible"
10
- v-model="visible"
11
- :title="placeholder"
12
- :z-index="1031"
13
- :bodyStyle="{ maxHeight: '68vh', overflowY: 'auto' }"
14
- @ok="handleOk"
15
- @close="visible=false"
16
- >
17
- <!-- 搜索框 -->
18
- <a-input-search :value="searchValue" style="margin-bottom: 8px" placeholder="搜索" @change="handleSearch"/>
19
- <!-- 树形图 -->
20
- <a-tree
21
- v-model="checkedKeys"
22
- :expanded-keys="expandedKeys"
23
- :selectable="false"
24
- checkable
25
- @expand="onExpand"
26
- >
27
- <!-- department -->
28
- <a-tree-node
29
- v-for="department in treeData"
30
- v-show="!department.hidden"
31
- :key="department.key"
32
- :title="department.title">
33
- <!-- person -->
34
- <a-tree-node v-for="person in department.children" v-show="!person.hidden" :key="person.key">
35
- <!-- 搜索关键词红色 -->
36
- <template slot="title">
37
- <span v-if="person.title.indexOf(searchValue) > -1">
38
- {{ person.title.substr(0, person.title.indexOf(searchValue)) }}
39
- <span style="color: #f50">{{ searchValue }}</span>
40
- {{ person.title.substr(person.title.indexOf(searchValue) + searchValue.length) }}
41
- </span>
42
- <span v-else>{{ person.title }}</span>
43
- </template>
44
- </a-tree-node>
45
- </a-tree-node>
46
- </a-tree>
47
- </a-modal>
48
- </div>
49
- </template>
50
-
51
- <script>
52
- import { commonApi, post } from '@vue2-client/services/api'
53
-
54
- const departments = ['运维部', '项目部', '项目一部', '项目二部', '开发部', '售后部', '办公室', '管理员', '软件工程部', 'IC卡部', '销售部']
55
-
56
- export default {
57
- name: 'PersonSetting',
58
- data () {
59
- return {
60
- searchValue: '',
61
- treeData: [],
62
- checkedKeys: [],
63
- expandedKeys: [],
64
- sourceTreeData: [],
65
- visible: false,
66
- valueView: this.placeholder
67
- }
68
- },
69
- props: {
70
- buttonText: {
71
- type: String,
72
- default: '选择人员'
73
- },
74
- placeholder: {
75
- type: String,
76
- default: '请选择人员'
77
- },
78
- value: {
79
- type: Array,
80
- default: () => []
81
- },
82
- // // 返回数据类型 String,Array 发现返回类型只能有一个
83
- // type: {
84
- // type: String,
85
- // default: 'Array'
86
- // },
87
- // 返回数据字段 name , id
88
- field: {
89
- type: String,
90
- default: 'name'
91
- },
92
- },
93
- model: {
94
- prop: 'value',
95
- event: 'onOk'
96
- },
97
- watch: {},
98
- components: {},
99
- created () {
100
- post(commonApi.getEmpTree, {}).then(res => {
101
- this.sourceTreeData = res
102
- })
103
- },
104
- methods: {
105
- inputClick () {
106
- this.visible = true
107
- this.searchValue = ''
108
- this.treeData = this.sourceTreeData
109
- if (this.value.length > 0) {
110
- this.checkedKeys = this.getCheckedKeys(this.value)
111
- }
112
- this.expandedKeys = []
113
- },
114
- // 获取选择得key
115
- getCheckedKeys (arr) {
116
- const brr = []
117
- this.treeData.forEach(item => {
118
- adaptToChildrenList(item)
119
- })
120
- function adaptToChildrenList (o) {
121
- if (arr.some(item => o.key.indexOf(item) > -1)) {
122
- brr.push(o.key)
123
- }
124
- if (o.children) {
125
- for (const c of o.children) {
126
- adaptToChildrenList(c)
127
- }
128
- }
129
- }
130
- return brr
131
- },
132
- handleOk () {
133
- this.$emit('onOk', this.allPerson())
134
- this.visible = false
135
- },
136
- onExpand (expandedKeys) {
137
- this.expandedKeys = expandedKeys
138
- },
139
- // 搜索处理
140
- handleSearch (e) {
141
- const value = e.target.value.trim()
142
- if (!value) {
143
- this.treeData = this.sourceTreeData
144
- this.expandedKeys = []
145
- this.searchValue = ''
146
- return
147
- }
148
- const expandedKeys = []
149
- const treeData = JSON.parse(JSON.stringify(this.sourceTreeData))
150
- // 过滤结果
151
- for (const department of treeData) {
152
- if (department.key.includes(value)) {
153
- continue
154
- }
155
- let hasChildren = false
156
- if (department.children) {
157
- for (const person of department.children) {
158
- if (!person.key.includes(value)) {
159
- person.hidden = true
160
- } else {
161
- hasChildren = true
162
- }
163
- }
164
- }
165
- if (!hasChildren) {
166
- department.hidden = true
167
- } else {
168
- expandedKeys.push(department.key)
169
- }
170
- }
171
- this.treeData = treeData
172
- this.expandedKeys = expandedKeys
173
- this.searchValue = value
174
- },
175
- allPerson () {
176
- const index = this.type === 'id' ? 1 : 0
177
- const _allPerson = this.checkedKeys.filter(value => !departments.includes(value)).map(item => item.split('_')[index])
178
- this.valueView = this.checkedKeys.filter(value => !departments.includes(value)).map(item => item.split('_')[0]).join(',')
179
- return _allPerson
180
- }
181
- },
182
- }
183
- </script>
184
- <style lang="less" scoped>
185
- .ant-tree-title {
186
- width: 100%;
187
- }
188
-
189
- .title {
190
- float: left;
191
- }
192
-
193
- .ant-card-body {
194
- :global {
195
- .ant-tree {
196
- line-height: 3;
197
-
198
- li {
199
- position: relative;
200
- }
201
- }
202
- }
203
- }
204
-
205
- .ant-card-body .but_type {
206
- float: right;
207
- position: absolute;
208
- right: 40px;
209
- }
210
- </style>
1
+ <template>
2
+ <div>
3
+ <a-input
4
+ @click="inputClick"
5
+ :value="valueView"
6
+ style="cursor:pointer"
7
+ readOnly/>
8
+ <a-modal
9
+ v-if="visible"
10
+ v-model="visible"
11
+ :title="placeholder"
12
+ :z-index="1031"
13
+ :bodyStyle="{ maxHeight: '68vh', overflowY: 'auto' }"
14
+ @ok="handleOk"
15
+ @close="visible=false"
16
+ >
17
+ <!-- 搜索框 -->
18
+ <a-input-search :value="searchValue" style="margin-bottom: 8px" placeholder="搜索" @change="handleSearch"/>
19
+ <!-- 树形图 -->
20
+ <a-tree
21
+ v-model="checkedKeys"
22
+ :expanded-keys="expandedKeys"
23
+ :selectable="false"
24
+ checkable
25
+ @expand="onExpand"
26
+ >
27
+ <!-- department -->
28
+ <a-tree-node
29
+ v-for="department in treeData"
30
+ v-show="!department.hidden"
31
+ :key="department.key"
32
+ :title="department.title">
33
+ <!-- person -->
34
+ <a-tree-node v-for="person in department.children" v-show="!person.hidden" :key="person.key">
35
+ <!-- 搜索关键词红色 -->
36
+ <template slot="title">
37
+ <span v-if="person.title.indexOf(searchValue) > -1">
38
+ {{ person.title.substr(0, person.title.indexOf(searchValue)) }}
39
+ <span style="color: #f50">{{ searchValue }}</span>
40
+ {{ person.title.substr(person.title.indexOf(searchValue) + searchValue.length) }}
41
+ </span>
42
+ <span v-else>{{ person.title }}</span>
43
+ </template>
44
+ </a-tree-node>
45
+ </a-tree-node>
46
+ </a-tree>
47
+ </a-modal>
48
+ </div>
49
+ </template>
50
+
51
+ <script>
52
+ import { commonApi, post } from '@vue2-client/services/api'
53
+
54
+ const departments = ['运维部', '项目部', '项目一部', '项目二部', '开发部', '售后部', '办公室', '管理员', '软件工程部', 'IC卡部', '销售部']
55
+
56
+ export default {
57
+ name: 'PersonSetting',
58
+ data () {
59
+ return {
60
+ searchValue: '',
61
+ treeData: [],
62
+ checkedKeys: [],
63
+ expandedKeys: [],
64
+ sourceTreeData: [],
65
+ visible: false,
66
+ valueView: this.placeholder
67
+ }
68
+ },
69
+ props: {
70
+ buttonText: {
71
+ type: String,
72
+ default: '选择人员'
73
+ },
74
+ placeholder: {
75
+ type: String,
76
+ default: '请选择人员'
77
+ },
78
+ value: {
79
+ type: Array,
80
+ default: () => []
81
+ },
82
+ // // 返回数据类型 String,Array 发现返回类型只能有一个
83
+ // type: {
84
+ // type: String,
85
+ // default: 'Array'
86
+ // },
87
+ // 返回数据字段 name , id
88
+ field: {
89
+ type: String,
90
+ default: 'name'
91
+ },
92
+ },
93
+ model: {
94
+ prop: 'value',
95
+ event: 'onOk'
96
+ },
97
+ watch: {},
98
+ components: {},
99
+ created () {
100
+ post(commonApi.getEmpTree, {}).then(res => {
101
+ this.sourceTreeData = res
102
+ })
103
+ },
104
+ methods: {
105
+ inputClick () {
106
+ this.visible = true
107
+ this.searchValue = ''
108
+ this.treeData = this.sourceTreeData
109
+ if (this.value.length > 0) {
110
+ this.checkedKeys = this.getCheckedKeys(this.value)
111
+ }
112
+ this.expandedKeys = []
113
+ },
114
+ // 获取选择得key
115
+ getCheckedKeys (arr) {
116
+ const brr = []
117
+ this.treeData.forEach(item => {
118
+ adaptToChildrenList(item)
119
+ })
120
+ function adaptToChildrenList (o) {
121
+ if (arr.some(item => o.key.indexOf(item) > -1)) {
122
+ brr.push(o.key)
123
+ }
124
+ if (o.children) {
125
+ for (const c of o.children) {
126
+ adaptToChildrenList(c)
127
+ }
128
+ }
129
+ }
130
+ return brr
131
+ },
132
+ handleOk () {
133
+ this.$emit('onOk', this.allPerson())
134
+ this.visible = false
135
+ },
136
+ onExpand (expandedKeys) {
137
+ this.expandedKeys = expandedKeys
138
+ },
139
+ // 搜索处理
140
+ handleSearch (e) {
141
+ const value = e.target.value.trim()
142
+ if (!value) {
143
+ this.treeData = this.sourceTreeData
144
+ this.expandedKeys = []
145
+ this.searchValue = ''
146
+ return
147
+ }
148
+ const expandedKeys = []
149
+ const treeData = JSON.parse(JSON.stringify(this.sourceTreeData))
150
+ // 过滤结果
151
+ for (const department of treeData) {
152
+ if (department.key.includes(value)) {
153
+ continue
154
+ }
155
+ let hasChildren = false
156
+ if (department.children) {
157
+ for (const person of department.children) {
158
+ if (!person.key.includes(value)) {
159
+ person.hidden = true
160
+ } else {
161
+ hasChildren = true
162
+ }
163
+ }
164
+ }
165
+ if (!hasChildren) {
166
+ department.hidden = true
167
+ } else {
168
+ expandedKeys.push(department.key)
169
+ }
170
+ }
171
+ this.treeData = treeData
172
+ this.expandedKeys = expandedKeys
173
+ this.searchValue = value
174
+ },
175
+ allPerson () {
176
+ const index = this.type === 'id' ? 1 : 0
177
+ const _allPerson = this.checkedKeys.filter(value => !departments.includes(value)).map(item => item.split('_')[index])
178
+ this.valueView = this.checkedKeys.filter(value => !departments.includes(value)).map(item => item.split('_')[0]).join(',')
179
+ return _allPerson
180
+ }
181
+ },
182
+ }
183
+ </script>
184
+ <style lang="less" scoped>
185
+ .ant-tree-title {
186
+ width: 100%;
187
+ }
188
+
189
+ .title {
190
+ float: left;
191
+ }
192
+
193
+ .ant-card-body {
194
+ :global {
195
+ .ant-tree {
196
+ line-height: 3;
197
+
198
+ li {
199
+ position: relative;
200
+ }
201
+ }
202
+ }
203
+ }
204
+
205
+ .ant-card-body .but_type {
206
+ float: right;
207
+ position: absolute;
208
+ right: 40px;
209
+ }
210
+ </style>
@@ -1,3 +1,3 @@
1
- import PersonSetting from './PersonSetting'
2
-
3
- export default PersonSetting
1
+ import PersonSetting from './PersonSetting'
2
+
3
+ export default PersonSetting
@@ -1,3 +1,3 @@
1
- import Upload from './Upload'
2
-
3
- export default Upload
1
+ import Upload from './Upload'
2
+
3
+ export default Upload
@@ -334,15 +334,6 @@ export default {
334
334
  */
335
335
  refreshTable (toFirstPage = true) {
336
336
  this.$refs.xTable.refresh(toFirstPage)
337
- },
338
- /**
339
- * 设置固定查询表单
340
- */
341
- setFixedQueryForm (form, isRefreshTable) {
342
- this.fixedQueryForm = form
343
- if (isRefreshTable) {
344
- this.refreshTable(true)
345
- }
346
337
  }
347
338
  }
348
339
  }
@@ -324,7 +324,9 @@ export default {
324
324
  * 如果参数为 true, 则强制刷新到第一页
325
325
  */
326
326
  refresh (bool) {
327
- this.$refs.table.refresh(bool)
327
+ this.$nextTick(() => {
328
+ this.$refs.table.refresh(bool)
329
+ })
328
330
  },
329
331
  /**
330
332
  * 格式化日期
@@ -1,41 +1,41 @@
1
- import XForm from './common/XForm'
2
- import XAddForm from './common/XAddForm'
3
- import XAddNativeForm from './common/XAddNativeForm'
4
- import XFormCol from './common/XFormCol'
5
- import XTable from './common/XTable'
6
- import XTreeOne from './common/XTreeOne'
7
- import XImportExcel from './common/XImportExcel'
8
- import XDataDrawer from './common/XDataDrawer'
9
- import XCard from './common/XCard'
10
- import XBadge from './common/XBadge'
11
- import Upload from './common/Upload'
12
- import JSONToTree from './common/JSONToTree'
13
- import FormGroupEdit from './common/FormGroupEdit'
14
- import FormGroupQuery from './common/FormGroupQuery'
15
- import AddressSearchCombobox from './common/AddressSearchCombobox'
16
- import AmapMarker from './common/AmapMarker'
17
- import CreateQuery from './common/CreateQuery'
18
- import CreateSimpleFormQuery from './common/CreateSimpleFormQuery'
19
- import PersonSetting from './common/PersonSetting'
20
-
21
- export default {
22
- XForm,
23
- XAddForm,
24
- XAddNativeForm,
25
- XFormCol,
26
- XTable,
27
- XTreeOne,
28
- XImportExcel,
29
- XDataDrawer,
30
- XCard,
31
- XBadge,
32
- Upload,
33
- JSONToTree,
34
- FormGroupEdit,
35
- FormGroupQuery,
36
- AddressSearchCombobox,
37
- AmapMarker,
38
- CreateQuery,
39
- CreateSimpleFormQuery,
40
- PersonSetting
41
- }
1
+ import XForm from './common/XForm'
2
+ import XAddForm from './common/XAddForm'
3
+ import XAddNativeForm from './common/XAddNativeForm'
4
+ import XFormCol from './common/XFormCol'
5
+ import XTable from './common/XTable'
6
+ import XTreeOne from './common/XTreeOne'
7
+ import XImportExcel from './common/XImportExcel'
8
+ import XDataDrawer from './common/XDataDrawer'
9
+ import XCard from './common/XCard'
10
+ import XBadge from './common/XBadge'
11
+ import Upload from './common/Upload'
12
+ import JSONToTree from './common/JSONToTree'
13
+ import FormGroupEdit from './common/FormGroupEdit'
14
+ import FormGroupQuery from './common/FormGroupQuery'
15
+ import AddressSearchCombobox from './common/AddressSearchCombobox'
16
+ import AmapMarker from './common/AmapMarker'
17
+ import CreateQuery from './common/CreateQuery'
18
+ import CreateSimpleFormQuery from './common/CreateSimpleFormQuery'
19
+ import PersonSetting from './common/PersonSetting'
20
+
21
+ export default {
22
+ XForm,
23
+ XAddForm,
24
+ XAddNativeForm,
25
+ XFormCol,
26
+ XTable,
27
+ XTreeOne,
28
+ XImportExcel,
29
+ XDataDrawer,
30
+ XCard,
31
+ XBadge,
32
+ Upload,
33
+ JSONToTree,
34
+ FormGroupEdit,
35
+ FormGroupQuery,
36
+ AddressSearchCombobox,
37
+ AmapMarker,
38
+ CreateQuery,
39
+ CreateSimpleFormQuery,
40
+ PersonSetting
41
+ }
@@ -1,24 +1,24 @@
1
- import { METHOD, request } from '@vue2-client/utils/request'
2
-
3
- /**
4
- * GET请求
5
- * @param url 请求地址
6
- * @param parameter 路径参数
7
- * @returns {Promise<AxiosResponse<T>>}
8
- */
9
- function get (url, parameter) {
10
- return request(url, METHOD.GET, parameter)
11
- }
12
-
13
- /**
14
- * POST请求
15
- * @param url 请求地址
16
- * @param parameter 请求参数
17
- * @param config
18
- * @returns {Promise<AxiosResponse<T>>}
19
- */
20
- function post (url, parameter, config = {}) {
21
- return request(url, METHOD.POST, parameter, config)
22
- }
23
-
24
- export { get, post }
1
+ import { METHOD, request } from '@vue2-client/utils/request'
2
+
3
+ /**
4
+ * GET请求
5
+ * @param url 请求地址
6
+ * @param parameter 路径参数
7
+ * @returns {Promise<AxiosResponse<T>>}
8
+ */
9
+ function get (url, parameter) {
10
+ return request(url, METHOD.GET, parameter)
11
+ }
12
+
13
+ /**
14
+ * POST请求
15
+ * @param url 请求地址
16
+ * @param parameter 请求参数
17
+ * @param config
18
+ * @returns {Promise<AxiosResponse<T>>}
19
+ */
20
+ function post (url, parameter, config = {}) {
21
+ return request(url, METHOD.POST, parameter, config)
22
+ }
23
+
24
+ export { get, post }