vue2-client 1.8.417 → 1.8.418
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.
- package/docs//345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +59 -0
- package/package.json +1 -1
- package/src/base-client/components/common/XAddReport/XAddReport.vue +3 -0
- package/src/base-client/components/common/XLicensePlate/XLicensePlate.vue +165 -18
- package/src/base-client/components/common/XLicensePlate/XLicensePlateDemo.vue +48 -0
- package/src/main.js +1 -3
- package/src/router/async/router.map.js +1 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# function总体说明
|
|
2
|
+
- function的参数,与具体事件有关系。可以在函数里,通过console.log('>>>参数', arguments)显示参数内容。
|
|
3
|
+
- 如果function的参数里没有需要的数据,用this.函数/属性,可以取需要的内容,具体内容,与组件类型有关。
|
|
4
|
+
- 用this.函数函数调用方式调用相应功能。
|
|
5
|
+
|
|
6
|
+
# 通过this可以调用的函数
|
|
7
|
+
- openDialog(configName, selectedId, mixinData):打开一个对话框,例如:this.openDialog('xxx', 5, {})
|
|
8
|
+
- runLogic(logicName, parameter): 运行业务逻辑, 例如: this.runLogic('xxx', {})
|
|
9
|
+
|
|
10
|
+
# 如何调用珊格中组件的数据及函数
|
|
11
|
+
- 先给组件起名字,命名规范:main,left,right,top,bottom
|
|
12
|
+
- 用 this.getComponentByName('main') 拿到组件。
|
|
13
|
+
|
|
14
|
+
# x-form-table 可以使用的函数/数据
|
|
15
|
+
```js
|
|
16
|
+
假如组件名称叫 xtable
|
|
17
|
+
// 所有选中的id
|
|
18
|
+
const allid = this.$refs.xtable.table_selectedRowKeys
|
|
19
|
+
// 所有选中的行 table_selectedRowKeys
|
|
20
|
+
const allrecord = this.$refs.xtable.table_selectedRows
|
|
21
|
+
- 获取selectedid getSelectedId()
|
|
22
|
+
- 重新查询 refreshTable()
|
|
23
|
+
|
|
24
|
+
// xtable 所调用事件
|
|
25
|
+
// 新增修改后调用事件
|
|
26
|
+
afterSubmit( type(新增/修改/擦和讯), id: (所操作的主键id), form: (请求的表单内容))
|
|
27
|
+
// 查询后
|
|
28
|
+
afterQuery( res (查询后数据), querparams (查询参数))
|
|
29
|
+
// 删除后
|
|
30
|
+
afterDelete( res (删除接口返回数据))
|
|
31
|
+
// 操作按钮
|
|
32
|
+
action(record (当前记录), id (当前记录主键), actionType (操作类型))
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# form 简易表单
|
|
37
|
+
```js
|
|
38
|
+
假如组件名称叫 xform
|
|
39
|
+
// 主动调用提交函数
|
|
40
|
+
this.$refs.xform.asyncSubmit((res )=>{}) res 为表单内容
|
|
41
|
+
// 设置 表单内容
|
|
42
|
+
this.$refs.xform.setForm(obj) obj 用于合并到 form 对象中
|
|
43
|
+
|
|
44
|
+
// xform 所调用事件 点击自带提交按钮后调用
|
|
45
|
+
onSubmit( form: (请求的表单内容))
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
# 每种事件处理,传递给function的参数
|
|
49
|
+
- 添加处理:空
|
|
50
|
+
- action:(操作行数据)
|
|
51
|
+
- 自定义按钮:(选中的所有行)
|
|
52
|
+
|
|
53
|
+
# 例子
|
|
54
|
+
function() {
|
|
55
|
+
// 获取主formtable组件
|
|
56
|
+
main = this.$refs.main.getComponentByName('main')
|
|
57
|
+
// 把组件当前选中的项及select_id传给后台业务逻辑
|
|
58
|
+
this.runLogic('logic', {select_id: main.getSelectedId(), rows: main.refreshTable()})
|
|
59
|
+
}
|
package/package.json
CHANGED
|
@@ -100,6 +100,9 @@ export default {
|
|
|
100
100
|
this.visible = false
|
|
101
101
|
this.$emit('close')
|
|
102
102
|
},
|
|
103
|
+
getComponentByName (name) {
|
|
104
|
+
return this.$refs.main.getComponentByName(name)
|
|
105
|
+
},
|
|
103
106
|
onSubmit () {
|
|
104
107
|
if (this.$refs.main?.config?.confirmFunction) {
|
|
105
108
|
console.info('执行自定义确认逻辑')
|
|
@@ -1,46 +1,193 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
<div @click="openSelectLicensePlate" class="clickable-input">
|
|
4
|
+
<a-input :placeholder="placeholder" v-model="licensePlate" readonly class="clickable-input"/>
|
|
5
|
+
</div>
|
|
6
|
+
<a-modal v-model="licensePlateShow" title="选择车牌号" :bodyStyle="{height:'auto'}" @ok="okHandle">
|
|
7
|
+
<div class="license-plate_container">
|
|
8
|
+
<!-- 输入框 -->
|
|
9
|
+
<div @click="onSlotClick">
|
|
10
|
+
<div class="input_container">
|
|
11
|
+
<a-space>
|
|
12
|
+
<div style="margin: 0;padding: 0" v-for="(item, index) in 2" :key="`${item}_${inputValue[index]}`">
|
|
13
|
+
<a-input
|
|
14
|
+
v-model="inputValue[index]"
|
|
15
|
+
@click.stop="inputClick(index)"
|
|
16
|
+
style="width: 2.3rem"
|
|
17
|
+
:maxLength="1">
|
|
18
|
+
</a-input>
|
|
19
|
+
</div>
|
|
20
|
+
<b>·</b>
|
|
21
|
+
<div style="margin: 0;padding: 0" v-for="(item, index) in 6" :key="`${item}_${inputValue[index]}`">
|
|
22
|
+
<a-input
|
|
23
|
+
v-model="inputValue[index+2]"
|
|
24
|
+
@click.stop="inputClick(index+2)"
|
|
25
|
+
style="width: 2.3rem"
|
|
26
|
+
:maxLength="1">
|
|
27
|
+
</a-input>
|
|
28
|
+
</div>
|
|
29
|
+
</a-space>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
<!-- 键盘 -->
|
|
33
|
+
<div class="keyboard_container">
|
|
34
|
+
<a-row type="flex">
|
|
35
|
+
<a-col v-if="activeIndex === 0" span="3" v-for="item in provinceList" :key="item">
|
|
36
|
+
<a-button
|
|
37
|
+
class="button"
|
|
38
|
+
@click="btnClick(item)"> {{ item }}
|
|
39
|
+
</a-button>
|
|
40
|
+
</a-col>
|
|
41
|
+
<a-col span="3" v-if="activeIndex !== 0" v-for="(item, index) of numberList" :key="item">
|
|
42
|
+
<a-button
|
|
43
|
+
class="button"
|
|
44
|
+
@click="btnClick(item, activeIndex === 1)"
|
|
45
|
+
:disabled="activeIndex === 1 && index < 10"> {{ item }}
|
|
46
|
+
</a-button>
|
|
47
|
+
</a-col>
|
|
48
|
+
<a-col span="3" v-if="activeIndex !== 0" v-for="item of letterList" :key="item">
|
|
49
|
+
<a-button
|
|
50
|
+
class="button"
|
|
51
|
+
@click="btnClick(item, item === 'O' && activeIndex > 1)"
|
|
52
|
+
:disabled="item === 'O' && activeIndex > 1"> {{ item }}
|
|
53
|
+
</a-button>
|
|
54
|
+
</a-col>
|
|
55
|
+
<a-col span="3" v-if="activeIndex !== 0" v-for="item of charList" :key="item">
|
|
56
|
+
<a-button
|
|
57
|
+
class="button"
|
|
58
|
+
@click="btnClick(item, activeIndex < 5)"
|
|
59
|
+
:disabled="activeIndex < 7"> {{ item }}
|
|
60
|
+
</a-button>
|
|
61
|
+
</a-col>
|
|
62
|
+
<a-button type="dashed" v-if="activeIndex !== 0" @click="delClick" class="button last-button">
|
|
63
|
+
<a-icon type="swap-left"/>
|
|
64
|
+
删除
|
|
65
|
+
</a-button>
|
|
66
|
+
</a-row>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
6
69
|
</a-modal>
|
|
7
70
|
</div>
|
|
8
71
|
</template>
|
|
9
72
|
|
|
10
73
|
<script>
|
|
74
|
+
const LICENSE_PLATE_RULE = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳使领]$/
|
|
11
75
|
export default {
|
|
12
76
|
name: 'XLicensePlate',
|
|
13
77
|
props: {
|
|
78
|
+
value: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: ''
|
|
81
|
+
},
|
|
14
82
|
placeholder: {
|
|
15
83
|
type: String,
|
|
16
84
|
default: '请输入车牌号'
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
components: {
|
|
85
|
+
},
|
|
20
86
|
},
|
|
21
87
|
data () {
|
|
22
88
|
return {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
89
|
+
provinceList: ['京', '津', '渝', '沪', '冀', '晋', '辽', '吉', '黑', '苏', '浙', '皖', '闽', '赣', '鲁', '豫', '鄂', '湘', '粤', '琼', '川', '贵', '云', '陕', '甘', '青', '蒙', '桂', '宁', '新', '藏', '临'],
|
|
90
|
+
numberList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
|
|
91
|
+
letterList: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],
|
|
92
|
+
charList: ['警', '领', '港', '澳', '挂', '学'],
|
|
93
|
+
activeIndex: -1,
|
|
94
|
+
inputValue: ['', '', '', '', '', '', '', ''],
|
|
95
|
+
licensePlateShow: false
|
|
26
96
|
}
|
|
27
97
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
98
|
+
computed: {
|
|
99
|
+
licensePlate () {
|
|
100
|
+
return this.inputValue.join('')
|
|
101
|
+
}
|
|
31
102
|
},
|
|
32
103
|
watch: {
|
|
104
|
+
value () {
|
|
105
|
+
this.initLicensePlate()
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
mounted () {
|
|
109
|
+
this.initLicensePlate()
|
|
110
|
+
this.activeIndex = 0
|
|
33
111
|
},
|
|
34
112
|
methods: {
|
|
113
|
+
okHandle () {
|
|
114
|
+
this.licensePlateShow = false
|
|
115
|
+
this.change()
|
|
116
|
+
},
|
|
35
117
|
openSelectLicensePlate () {
|
|
36
|
-
this.
|
|
118
|
+
this.licensePlateShow = true
|
|
119
|
+
},
|
|
120
|
+
initLicensePlate () {
|
|
121
|
+
if (this.value && LICENSE_PLATE_RULE.test(this.value)) {
|
|
122
|
+
this.inputValue = this.value.split('')
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
onSlotClick (event) {
|
|
126
|
+
const length = this.inputValue.filter(it => it).length
|
|
127
|
+
this.activeIndex = length == 0 ? 0 : length - 1
|
|
128
|
+
},
|
|
129
|
+
inputClick (index, event) {
|
|
130
|
+
this.activeIndex = index
|
|
37
131
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
132
|
+
btnClick (val, disabled) {
|
|
133
|
+
if (disabled) {
|
|
134
|
+
return false
|
|
135
|
+
}
|
|
136
|
+
this.$set(this.inputValue, this.activeIndex, `${val}`)
|
|
137
|
+
this.activeIndex++
|
|
138
|
+
this.change()
|
|
139
|
+
},
|
|
140
|
+
delClick () {
|
|
141
|
+
if (this.inputValue[this.activeIndex]) {
|
|
142
|
+
this.$set(this.inputValue, this.activeIndex, ``)
|
|
143
|
+
} else {
|
|
144
|
+
this.$set(this.inputValue, this.activeIndex - 1, ``)
|
|
145
|
+
this.activeIndex--
|
|
146
|
+
}
|
|
147
|
+
this.change()
|
|
148
|
+
},
|
|
149
|
+
change () {
|
|
150
|
+
const value = this.inputValue.join('')
|
|
151
|
+
const pass = LICENSE_PLATE_RULE.test(value)
|
|
152
|
+
this.$emit('change', {
|
|
153
|
+
array: this.inputValue.filter(it => it !== ''),
|
|
154
|
+
value: value,
|
|
155
|
+
pass: pass,
|
|
156
|
+
})
|
|
157
|
+
this.$emit('input', value)
|
|
43
158
|
}
|
|
44
159
|
}
|
|
45
160
|
}
|
|
46
161
|
</script>
|
|
162
|
+
|
|
163
|
+
<style lang='less' scoped>
|
|
164
|
+
.license-plate_container {
|
|
165
|
+
box-sizing: border-box;
|
|
166
|
+
|
|
167
|
+
.input_container {
|
|
168
|
+
display: flex;
|
|
169
|
+
align-items: center;
|
|
170
|
+
justify-content: center;
|
|
171
|
+
margin-bottom: 10px;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.keyboard_container {
|
|
175
|
+
width: 100%;
|
|
176
|
+
height: auto;
|
|
177
|
+
background-color: #e2e3e7;
|
|
178
|
+
padding: 10px 10px calc(env(safe-area-inset-bottom) + 10px) 5px;
|
|
179
|
+
box-sizing: border-box;
|
|
180
|
+
text-align: center;
|
|
181
|
+
|
|
182
|
+
.button {
|
|
183
|
+
margin: 2px;
|
|
184
|
+
width: 2.8rem;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.last-button {
|
|
188
|
+
width: auto;
|
|
189
|
+
margin-left: 7px;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
</style>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<x-license-plate @change="change" v-model="licensePlate" :autoShow="false"/>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import XLicensePlate from './XLicensePlate.vue'
|
|
9
|
+
export default {
|
|
10
|
+
name: 'XLicensePlateDemo',
|
|
11
|
+
components: {
|
|
12
|
+
XLicensePlate
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
placeholder: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: '请输入车牌号'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
data () {
|
|
21
|
+
return {
|
|
22
|
+
licensePlate: '陕A1G78D',
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
filters: {},
|
|
26
|
+
created () {
|
|
27
|
+
},
|
|
28
|
+
watch: {
|
|
29
|
+
licensePlate (vale) {
|
|
30
|
+
console.log('监听model变化', vale)
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
methods: {
|
|
34
|
+
change (a) {
|
|
35
|
+
console.log(a, this.licensePlate)
|
|
36
|
+
console.log('数组形式:' + a.array)
|
|
37
|
+
console.log('字符串形式:' + a.value)
|
|
38
|
+
console.log('是否验证通过:' + a.pass)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
<style scoped>
|
|
44
|
+
.clickable-input input {
|
|
45
|
+
pointer-events: none;
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
}
|
|
48
|
+
</style>
|
package/src/main.js
CHANGED
|
@@ -5,14 +5,12 @@ import Vuex from 'vuex'
|
|
|
5
5
|
import { routerOptions, modules, i18n, message, bootstrap } from '../index'
|
|
6
6
|
import eventLogPlugin from '@/plugins/EventLogPlugin'
|
|
7
7
|
import findParentData from '@/plugins/FindParentsData'
|
|
8
|
-
import LicensePlate from 'vue-license-plate'
|
|
9
|
-
import 'vue-license-plate/lib/licensePlate.css'
|
|
10
8
|
|
|
11
9
|
Vue.use(Router)
|
|
12
10
|
Vue.use(Vuex)
|
|
13
11
|
Vue.use(eventLogPlugin)
|
|
14
12
|
Vue.use(findParentData)
|
|
15
|
-
|
|
13
|
+
|
|
16
14
|
// 创建router store
|
|
17
15
|
const store = new Vuex.Store({ modules })
|
|
18
16
|
const router = new Router(routerOptions)
|
|
@@ -78,7 +78,7 @@ routerResource.example = {
|
|
|
78
78
|
{
|
|
79
79
|
path: 'default',
|
|
80
80
|
name: '示例页面',
|
|
81
|
-
component: () => import('@vue2-client/base-client/components/common/
|
|
81
|
+
component: () => import('@vue2-client/base-client/components/common/XLicensePlate/XLicensePlateDemo.vue'),
|
|
82
82
|
meta: {
|
|
83
83
|
// 菜单中不显示
|
|
84
84
|
invisible: true,
|