vue2-client 1.7.16 → 1.7.18

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.
@@ -428,6 +428,12 @@
428
428
  show-icon
429
429
  style="margin-top: 5px"
430
430
  type="info"/>
431
+ <a-alert
432
+ v-if="item.title.length > 8"
433
+ message="提示:标签名称过长可能会影响表格列展示效果,建议不超过8个字符"
434
+ show-icon
435
+ style="margin-top: 5px"
436
+ type="warning"/>
431
437
  </a-form-model>
432
438
  <create-query-item ref="queryItem" @getColumn="getColumnItem" @itemHandle="itemHandleItem"/>
433
439
  </a-modal>
@@ -581,8 +587,40 @@ export default {
581
587
  // 必填控制
582
588
  itemRules: {
583
589
  formType: [{ required: true, message: '请输入表单类型', trigger: 'change' }],
584
- key: [{ required: true, message: '请输入字段名称', trigger: 'blur' }],
585
- title: [{ required: true, message: '请输入标签名称', trigger: 'blur' }],
590
+ key: [{
591
+ required: true,
592
+ validator: (rule, value, callback) => {
593
+ // 判断必填
594
+ if (!value) {
595
+ callback(new Error('请输入字段名称'))
596
+ } else {
597
+ // 判断必须全部小写 并且不能包含空格
598
+ if (value !== value.toLowerCase() || value.indexOf(' ') !== -1) {
599
+ callback(new Error('字段名称必须全部小写,且不能包含空格'))
600
+ } else {
601
+ callback()
602
+ }
603
+ }
604
+ },
605
+ trigger: 'blur'
606
+ }],
607
+ title: [{
608
+ required: true,
609
+ validator: (rule, value, callback) => {
610
+ // 判断必填
611
+ if (!value) {
612
+ callback(new Error('请输入标签名称'))
613
+ } else {
614
+ // // 大于8个字符给提示
615
+ // if (value.length > 8) {
616
+ // callback(new Error('标签名称过长,建议不超过8个字符,可能会影响展示效果'))
617
+ // } else {
618
+ callback()
619
+ // }
620
+ }
621
+ },
622
+ trigger: 'blur'
623
+ }],
586
624
  selectType: [{ required: true, message: '请选择数据源类型', trigger: 'change' }],
587
625
  selectKey: [{ required: true, message: '请输入数据源内容', trigger: 'blur' }],
588
626
  'slot.value': [{ required: true, message: '请输入文本溢出上限长度', trigger: 'blur' }],
@@ -665,7 +703,7 @@ export default {
665
703
  this.dataModeArrayData = this.item.dataModeArray
666
704
  this.flashModal()
667
705
 
668
- for (const columnItem of this.item.column) {
706
+ for (const columnItem of this.item.column ?? []) {
669
707
  this.itemMap[columnItem.key] = Object.assign({
670
708
  key: '',
671
709
  title: '',
@@ -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
@@ -15,12 +15,12 @@
15
15
  :service-name="serviceName"
16
16
  :get-data-params="getDataParams"
17
17
  />
18
- <div v-for="(groupItem, groupIndex) in groupJsonData" :key="groupIndex">
18
+ <div v-for="(groupItem, groupIndex) in groupJsonData" :key="'group-' + groupIndex">
19
19
  <x-form-item
20
20
  v-for="(item, index) in groupItem.groupItems"
21
21
  :key="index"
22
22
  :attr="item"
23
- :form="form[groupItem.model]"
23
+ :form="form"
24
24
  :service-name="serviceName"
25
25
  :get-data-params="getDataParams"
26
26
  />
@@ -104,7 +104,7 @@ export default {
104
104
  }).map((item) => {
105
105
  item.groupItems = item.groupItems.filter(item => !item.isOnlyAddOrEdit).map((groupItem) => {
106
106
  // 只保留第一个下划线后面的内容
107
- groupItem.model = groupItem.model.substring(groupItem.model.indexOf('_') + 1)
107
+ // groupItem.model = groupItem.model.substring(groupItem.model.indexOf('_') + 1)
108
108
  return groupItem
109
109
  })
110
110
  return item
@@ -128,10 +128,9 @@ export default {
128
128
  // 处理分组数据表单
129
129
  for (let i = 0; i < this.groupJsonData.length; i++) {
130
130
  const groupItem = this.groupJsonData[i]
131
- formData[groupItem.model] = {}
132
131
  for (let j = 0; j < groupItem.groupItems.length; j++) {
133
132
  const item = groupItem.groupItems[j]
134
- this.setFormProps(formData[groupItem.model], item)
133
+ this.setFormProps(formData, item)
135
134
  }
136
135
  }
137
136
  this.form = formData
@@ -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
+ }
@@ -8,7 +8,6 @@ const GetAppDataService = {
8
8
  Vue.$appdata = Vue.prototype.$appdata = GetAppDataService
9
9
  },
10
10
  async load () {
11
- localStorage.removeItem(undefined)
12
11
  const params = {}
13
12
  await post(manageApi.getDictionaryValue, {}).then((res) => {
14
13
  Object.assign(params, res)
@@ -161,7 +161,7 @@ module.exports = {
161
161
  {
162
162
  label: '多彩徽标',
163
163
  key: 'badge',
164
- match: ['select', 'citySelect', 'addressSearch']
164
+ match: ['select', 'radio', 'citySelect', 'addressSearch']
165
165
  },
166
166
  {
167
167
  label: '日期格式化',