general-basic-form 2.0.10 → 2.0.11
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/README.assets/image-20210820173738506.png +0 -0
- package/README.md +5 -1
- package/package.json +3 -14
- package/script/link.ts +36 -0
- package/script/unlink.ts +45 -0
- package/src/GeneralBasicForm.vue +246 -0
- package/src/assets/image-20210820173037871.png +0 -0
- package/src/assets/logo.png +0 -0
- package/src/components/VBasic/cascader/index.vue +31 -0
- package/src/components/VBasic/date-picker/index.vue +30 -0
- package/src/components/VBasic/divider/index.vue +52 -0
- package/src/components/VBasic/input/index.vue +67 -0
- package/src/components/VBasic/input-graphic-verification/index.vue +56 -0
- package/src/components/VBasic/input-mobile-verification/index.vue +31 -0
- package/src/components/VBasic/input-mobile-verification/verification-button.vue +64 -0
- package/src/components/VBasic/input-number/index.vue +30 -0
- package/src/components/VBasic/radio/index.vue +40 -0
- package/src/components/VBasic/select/index.vue +37 -0
- package/src/components/setting.ts +28 -0
- package/src/index.ts +15 -0
- package/src/injectKey.ts +2 -0
- package/src/types/basicFrom.ts +53 -0
- package/src/types/componentsProps.ts +17 -0
- package/tsconfig.json +14 -0
- package/vite.config.js +123 -0
- package/dist/index.js +0 -524
- package/dist/index.umd.cjs +0 -1
- package/dist/style.css +0 -1
- /package/{dist → public}/index.d.ts +0 -0
|
Binary file
|
package/README.md
CHANGED
|
@@ -163,6 +163,7 @@ getList会传出默认的参数,首次请求时会有页数和分页大小,重
|
|
|
163
163
|
prop: "spName",
|
|
164
164
|
type: "select",
|
|
165
165
|
multiple:true, //多选
|
|
166
|
+
selectSetting:{},
|
|
166
167
|
option: [
|
|
167
168
|
{ value: "3", label: "满印" },
|
|
168
169
|
{ value: "1", label: "区域印花" },
|
|
@@ -173,7 +174,9 @@ getList会传出默认的参数,首次请求时会有页数和分页大小,重
|
|
|
173
174
|
label: "创建时间",
|
|
174
175
|
prop: "create_time",
|
|
175
176
|
type: "date-picker",
|
|
176
|
-
|
|
177
|
+
datePackerSetting: {
|
|
178
|
+
"range-separator": "至",
|
|
179
|
+
}
|
|
177
180
|
},
|
|
178
181
|
{
|
|
179
182
|
label: "二次工艺成本价格(人民币分)",
|
|
@@ -249,6 +252,7 @@ getList会传出默认的参数,首次请求时会有页数和分页大小,重
|
|
|
249
252
|
label: "分类",
|
|
250
253
|
prop: "分类",
|
|
251
254
|
type: "cascader",
|
|
255
|
+
selectSetting:{},
|
|
252
256
|
options: [
|
|
253
257
|
{
|
|
254
258
|
value: "zhinan",
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "general-basic-form",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.11",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "./
|
|
5
|
+
"main": "./src/index.ts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "cross-env CURRENT_ENV=prod run-p type-check build-only",
|
|
@@ -46,16 +46,5 @@
|
|
|
46
46
|
"vue": ">=3.3.4",
|
|
47
47
|
"vue-router": ">=4.2.4"
|
|
48
48
|
},
|
|
49
|
-
"typings": "./
|
|
50
|
-
"module": "./dist/index.js",
|
|
51
|
-
"exports": {
|
|
52
|
-
".": {
|
|
53
|
-
"import": "./dist/index.js",
|
|
54
|
-
"require": "./dist/index.umd.cjs"
|
|
55
|
-
},
|
|
56
|
-
"./style": "./dist/style.css"
|
|
57
|
-
},
|
|
58
|
-
"files": [
|
|
59
|
-
"/dist"
|
|
60
|
-
]
|
|
49
|
+
"typings": "./publish/index.d.ts"
|
|
61
50
|
}
|
package/script/link.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 陈德立*******419287484@qq.com
|
|
3
|
+
* @Date: 2023-11-10 09:39:59
|
|
4
|
+
* @LastEditTime: 2023-11-15 18:04:19
|
|
5
|
+
* @LastEditors: 陈德立*******419287484@qq.com
|
|
6
|
+
* @Github: https://github.com/Alan1034
|
|
7
|
+
* @Description: link处理流程
|
|
8
|
+
* @FilePath: \GeneralBasicForm\script\link.ts
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
import path from "path";
|
|
12
|
+
import fs from 'fs'
|
|
13
|
+
import chalk from 'chalk'
|
|
14
|
+
import { fileURLToPath } from 'url'
|
|
15
|
+
const __filenameNew = fileURLToPath(import.meta.url)
|
|
16
|
+
const __dirnameNew = path.dirname(__filenameNew)
|
|
17
|
+
const updateMain = () => {
|
|
18
|
+
try {
|
|
19
|
+
const packageTxt = fs.readFileSync(path.join(__dirnameNew, '../package.json'), 'utf8');
|
|
20
|
+
const packageJson = JSON.parse(packageTxt);
|
|
21
|
+
const mainDir = "./src/index.ts"
|
|
22
|
+
delete packageJson.files
|
|
23
|
+
delete packageJson.module
|
|
24
|
+
delete packageJson.exports
|
|
25
|
+
packageJson.typings = "./publish/index.d.ts"
|
|
26
|
+
packageJson.main = mainDir
|
|
27
|
+
const versionData = JSON.stringify(packageJson, null, 2);
|
|
28
|
+
fs.writeFileSync(path.join(__dirnameNew, '../package.json'), versionData, 'utf8');
|
|
29
|
+
console.log(chalk.green.bold('修改入口配置成功!当前入口路径为为:' + mainDir));
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.log(chalk.red.bold('修改入口配置出错:', error.toString()));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
updateMain()
|
package/script/unlink.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 陈德立*******419287484@qq.com
|
|
3
|
+
* @Date: 2023-11-10 09:39:59
|
|
4
|
+
* @LastEditTime: 2023-11-16 15:09:53
|
|
5
|
+
* @LastEditors: 陈德立*******419287484@qq.com
|
|
6
|
+
* @Github: https://github.com/Alan1034
|
|
7
|
+
* @Description: unlink处理流程
|
|
8
|
+
* @FilePath: \GeneralBasicForm\script\unlink.ts
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
import path from "path";
|
|
12
|
+
import fs from 'fs'
|
|
13
|
+
import chalk from 'chalk'
|
|
14
|
+
import { fileURLToPath } from 'url'
|
|
15
|
+
const __filenameNew = fileURLToPath(import.meta.url)
|
|
16
|
+
const __dirnameNew = path.dirname(__filenameNew)
|
|
17
|
+
const updateMain = () => {
|
|
18
|
+
try {
|
|
19
|
+
const packageTxt = fs.readFileSync(path.join(__dirnameNew, '../package.json'), 'utf8');
|
|
20
|
+
const packageJson = JSON.parse(packageTxt);
|
|
21
|
+
const umdDir = "./dist/index.umd.cjs"
|
|
22
|
+
const esDir = "./dist/index.js"
|
|
23
|
+
packageJson.main = umdDir
|
|
24
|
+
packageJson.module = esDir
|
|
25
|
+
packageJson.exports = {
|
|
26
|
+
".": {
|
|
27
|
+
"import": esDir,
|
|
28
|
+
"require": umdDir
|
|
29
|
+
},
|
|
30
|
+
"./style": "./dist/style.css"
|
|
31
|
+
}
|
|
32
|
+
packageJson.typings = "./dist/index.d.ts"
|
|
33
|
+
packageJson.files = [
|
|
34
|
+
"/dist"
|
|
35
|
+
]
|
|
36
|
+
const versionData = JSON.stringify(packageJson, null, 2);
|
|
37
|
+
fs.writeFileSync(path.join(__dirnameNew, '../package.json'), versionData, 'utf8');
|
|
38
|
+
console.log(chalk.green.bold('修改入口配置成功!当前入口路径为为:' + umdDir));
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.log(chalk.red.bold('修改入口配置出错:', error.toString()));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
updateMain()
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: 陈德立*******419287484@qq.com
|
|
3
|
+
* @Date: 2021-08-20 17:14:53
|
|
4
|
+
* @LastEditTime: 2023-12-07 17:07:44
|
|
5
|
+
* @LastEditors: 陈德立*******419287484@qq.com
|
|
6
|
+
* @Github: https://github.com/Alan1034
|
|
7
|
+
* @Description:
|
|
8
|
+
* @FilePath: \GeneralBasicForm\src\GeneralBasicForm.vue
|
|
9
|
+
*
|
|
10
|
+
-->
|
|
11
|
+
/** 通用基本表单。用在表单页面搜索栏 */
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<el-form
|
|
15
|
+
:model="queryParams"
|
|
16
|
+
ref="queryFormRef"
|
|
17
|
+
v-show="showSearch"
|
|
18
|
+
inline
|
|
19
|
+
label-position="left"
|
|
20
|
+
:label-width="labelWidth"
|
|
21
|
+
v-bind="$attrs"
|
|
22
|
+
>
|
|
23
|
+
<el-form-item
|
|
24
|
+
v-for="item in formItem"
|
|
25
|
+
:label="item.label"
|
|
26
|
+
:prop="item.prop"
|
|
27
|
+
:key="item.prop"
|
|
28
|
+
:rules="item.rules"
|
|
29
|
+
>
|
|
30
|
+
<Input v-if="item.type === 'input'" :item="item" />
|
|
31
|
+
<Radio v-if="item.type === 'radio'" :item="item" />
|
|
32
|
+
<Select v-if="item.type === 'select'" :item="item" />
|
|
33
|
+
<Divider v-if="item.type === 'divider'" :item="item" />
|
|
34
|
+
<Cascader v-if="item.type === 'cascader'" :item="item" />
|
|
35
|
+
<DatePicker v-if="item.type === 'date-picker'" :item="item" />
|
|
36
|
+
<InputNumber v-if="item.type === 'input-number'" :item="item" />
|
|
37
|
+
<InputMobileVerification
|
|
38
|
+
v-if="item.type === 'input-mobile-verification'"
|
|
39
|
+
:item="item"
|
|
40
|
+
/>
|
|
41
|
+
<InputGraphicVerification
|
|
42
|
+
v-if="item.type === 'input-graphic-verification'"
|
|
43
|
+
:item="item"
|
|
44
|
+
:key="item.key"
|
|
45
|
+
/>
|
|
46
|
+
</el-form-item>
|
|
47
|
+
<slot></slot>
|
|
48
|
+
<el-form-item v-if="!formOnly">
|
|
49
|
+
<el-button
|
|
50
|
+
type="primary"
|
|
51
|
+
:size="size"
|
|
52
|
+
@click="handleQuery"
|
|
53
|
+
v-loading="formLoading"
|
|
54
|
+
>查询</el-button
|
|
55
|
+
>
|
|
56
|
+
<el-button :size="size" @click="resetQuery">重置</el-button>
|
|
57
|
+
</el-form-item>
|
|
58
|
+
<slot name="behind-the-button" />
|
|
59
|
+
</el-form>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<script lang="ts">
|
|
63
|
+
import { provide, ref, PropType, defineComponent, computed } from "vue";
|
|
64
|
+
import type { ItemType } from "./types/basicFrom";
|
|
65
|
+
import { useRoute } from "vue-router";
|
|
66
|
+
import Input from "./components/VBasic/input/index.vue";
|
|
67
|
+
import InputNumber from "./components/VBasic/input-number/index.vue";
|
|
68
|
+
import InputGraphicVerification from "./components/VBasic/input-graphic-verification/index.vue";
|
|
69
|
+
import InputMobileVerification from "./components/VBasic/input-mobile-verification/index.vue";
|
|
70
|
+
import Divider from "./components/VBasic/divider/index.vue";
|
|
71
|
+
import Radio from "./components/VBasic/radio/index.vue";
|
|
72
|
+
import DatePicker from "./components/VBasic/date-picker/index.vue";
|
|
73
|
+
import Select from "./components/VBasic/select/index.vue";
|
|
74
|
+
import Cascader from "./components/VBasic/cascader/index.vue";
|
|
75
|
+
import { formLoadingKey } from "./injectKey";
|
|
76
|
+
|
|
77
|
+
export default defineComponent({
|
|
78
|
+
name: "GeneralBasicForm",
|
|
79
|
+
components: {
|
|
80
|
+
Input,
|
|
81
|
+
InputNumber,
|
|
82
|
+
InputGraphicVerification,
|
|
83
|
+
InputMobileVerification,
|
|
84
|
+
Divider,
|
|
85
|
+
Radio,
|
|
86
|
+
DatePicker,
|
|
87
|
+
Select,
|
|
88
|
+
Cascader,
|
|
89
|
+
},
|
|
90
|
+
props: {
|
|
91
|
+
showSearch: {
|
|
92
|
+
// 是否展示所有元素
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: true,
|
|
95
|
+
},
|
|
96
|
+
loading: {
|
|
97
|
+
// 加载动画
|
|
98
|
+
type: Boolean,
|
|
99
|
+
default: false,
|
|
100
|
+
},
|
|
101
|
+
formOnly: {
|
|
102
|
+
// 是否只展示表单不展示按钮
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: false,
|
|
105
|
+
},
|
|
106
|
+
getList: {
|
|
107
|
+
// 查找数据调用的函数
|
|
108
|
+
type: Function,
|
|
109
|
+
default: () => {},
|
|
110
|
+
},
|
|
111
|
+
afterReset: {
|
|
112
|
+
// 在重置按钮点击完后但还没重新请求时触发的的函数
|
|
113
|
+
type: Function,
|
|
114
|
+
default: () => {},
|
|
115
|
+
},
|
|
116
|
+
formItem: {
|
|
117
|
+
// 定义表单的数据
|
|
118
|
+
type: Array as unknown as PropType<ItemType[]>,
|
|
119
|
+
default: [],
|
|
120
|
+
},
|
|
121
|
+
size: {
|
|
122
|
+
// 控制按钮大小
|
|
123
|
+
type: String,
|
|
124
|
+
default: "default",
|
|
125
|
+
},
|
|
126
|
+
labelWidth: {
|
|
127
|
+
// 表单文字宽度
|
|
128
|
+
type: String,
|
|
129
|
+
default: "90px",
|
|
130
|
+
},
|
|
131
|
+
noUrlParameters: {
|
|
132
|
+
// 不接受和不改变url的参数
|
|
133
|
+
type: Boolean,
|
|
134
|
+
default: () => false,
|
|
135
|
+
},
|
|
136
|
+
formData: {
|
|
137
|
+
// 外部传入的表单数据,用于回填
|
|
138
|
+
type: Object,
|
|
139
|
+
default: () => {},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
data() {
|
|
143
|
+
return {
|
|
144
|
+
formLoading: this.loading || false,
|
|
145
|
+
};
|
|
146
|
+
},
|
|
147
|
+
setup(props) {
|
|
148
|
+
const { size, noUrlParameters, getList } = props;
|
|
149
|
+
const route = useRoute();
|
|
150
|
+
const queryParams = ref({
|
|
151
|
+
...(noUrlParameters ? {} : route?.query),
|
|
152
|
+
}); // form表单数据
|
|
153
|
+
provide(/* 注入名 */ "queryParams", /* 值 */ queryParams);
|
|
154
|
+
provide(/* 注入名 */ "size", /* 值 */ size);
|
|
155
|
+
provide(/* 注入名 */ "getList", /* 值 */ getList);
|
|
156
|
+
// const { formItem } = toRefs(props);
|
|
157
|
+
// const { formItem } = props;
|
|
158
|
+
// console.log(formItem);
|
|
159
|
+
// const queryParams = {};
|
|
160
|
+
// formItem.forEach((item) => {
|
|
161
|
+
// queryParams[item.prop] = "";
|
|
162
|
+
// });
|
|
163
|
+
return {
|
|
164
|
+
queryParams,
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
watch: {
|
|
168
|
+
formData: {
|
|
169
|
+
handler(val) {
|
|
170
|
+
// console.log(val);
|
|
171
|
+
this.queryParams = {
|
|
172
|
+
...(this.noUrlParameters ? {} : this.queryParams),
|
|
173
|
+
...val,
|
|
174
|
+
};
|
|
175
|
+
// console.log(this.queryParams);
|
|
176
|
+
},
|
|
177
|
+
// watch 默认是懒执行的:仅当数据源变化时,才会执行回调。但在某些场景中,我们希望在创建侦听器时,立即执行一遍回调。举例来说,我们想请求一些初始数据,然后在相关状态更改时重新请求数据。
|
|
178
|
+
// https://cn.vuejs.org/guide/essentials/watchers.html#deep-watchers
|
|
179
|
+
immediate: true,
|
|
180
|
+
// deep: true,
|
|
181
|
+
},
|
|
182
|
+
loading(val) {
|
|
183
|
+
// console.log("loading", val);
|
|
184
|
+
if (this.formLoading === val) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
this.formLoading = val;
|
|
188
|
+
},
|
|
189
|
+
formLoading(val) {
|
|
190
|
+
// console.log("formLoading", val);
|
|
191
|
+
if (this.loading === val) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
this.$emit("update:loading", val);
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
provide() {
|
|
198
|
+
return {
|
|
199
|
+
// 显式提供一个计算属性
|
|
200
|
+
[formLoadingKey]: {
|
|
201
|
+
formLoading: computed(() => this.formLoading),
|
|
202
|
+
updateFormLoading: (val) => {
|
|
203
|
+
this.formLoading = val;
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
},
|
|
208
|
+
methods: {
|
|
209
|
+
/** 搜索按钮操作 */
|
|
210
|
+
handleQuery() {
|
|
211
|
+
const params = { page: 1, limit: 10 };
|
|
212
|
+
const searchParams = {
|
|
213
|
+
...this.$route?.query,
|
|
214
|
+
...this.queryParams,
|
|
215
|
+
...params,
|
|
216
|
+
};
|
|
217
|
+
if (!this.noUrlParameters) {
|
|
218
|
+
this.$router.push({
|
|
219
|
+
query: { ...searchParams },
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
this.getList({
|
|
223
|
+
...searchParams,
|
|
224
|
+
});
|
|
225
|
+
},
|
|
226
|
+
/** 重置按钮操作 */
|
|
227
|
+
async resetQuery() {
|
|
228
|
+
this.$refs.queryFormRef.resetFields();
|
|
229
|
+
const params = { page: 1 };
|
|
230
|
+
if (!this.noUrlParameters) {
|
|
231
|
+
await this.$router.push({
|
|
232
|
+
query: { ...params },
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
this.queryParams = {
|
|
236
|
+
...(this.noUrlParameters ? {} : this.$route?.query),
|
|
237
|
+
};
|
|
238
|
+
this.afterReset();
|
|
239
|
+
this.handleQuery();
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
</script>
|
|
244
|
+
|
|
245
|
+
<style scoped>
|
|
246
|
+
</style>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: 陈德立*******419287484@qq.com
|
|
3
|
+
* @Date: 2023-11-08 18:03:42
|
|
4
|
+
* @LastEditTime: 2023-12-07 17:06:11
|
|
5
|
+
* @LastEditors: 陈德立*******419287484@qq.com
|
|
6
|
+
* @Github: https://github.com/Alan1034
|
|
7
|
+
* @Description:
|
|
8
|
+
* @FilePath: \GeneralBasicForm\src\components\VBasic\cascader\index.vue
|
|
9
|
+
*
|
|
10
|
+
-->
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import { selectDefaultSetting } from "../../setting";
|
|
13
|
+
import { ref, inject } from "vue";
|
|
14
|
+
import { BasicFormComponentsProps } from "../../../types/componentsProps";
|
|
15
|
+
const { item } = defineProps<{ item: any }>();
|
|
16
|
+
const queryParams = inject("queryParams", {});
|
|
17
|
+
const size = inject("size");
|
|
18
|
+
const selectSetting = ref({
|
|
19
|
+
...selectDefaultSetting,
|
|
20
|
+
...item.selectSetting,
|
|
21
|
+
});
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<el-cascader
|
|
26
|
+
v-model="queryParams[item.prop]"
|
|
27
|
+
:size="size"
|
|
28
|
+
:options="item.options || []"
|
|
29
|
+
v-bind="selectSetting"
|
|
30
|
+
></el-cascader>
|
|
31
|
+
</template>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: 陈德立*******419287484@qq.com
|
|
3
|
+
* @Date: 2023-11-08 18:03:42
|
|
4
|
+
* @LastEditTime: 2023-12-07 16:49:21
|
|
5
|
+
* @LastEditors: 陈德立*******419287484@qq.com
|
|
6
|
+
* @Github: https://github.com/Alan1034
|
|
7
|
+
* @Description:
|
|
8
|
+
* @FilePath: \GeneralBasicForm\src\components\VBasic\date-picker\index.vue
|
|
9
|
+
*
|
|
10
|
+
-->
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import { datePackerDefaultSetting } from "../../setting";
|
|
13
|
+
import { ref, inject } from "vue";
|
|
14
|
+
import { BasicFormComponentsProps } from "../../../types/componentsProps";
|
|
15
|
+
const { item } = defineProps<{ item: any }>();
|
|
16
|
+
const queryParams = inject("queryParams", {});
|
|
17
|
+
const size = inject("size");
|
|
18
|
+
const datePackerSetting = ref({
|
|
19
|
+
...datePackerDefaultSetting,
|
|
20
|
+
...item.datePackerSetting,
|
|
21
|
+
});
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<el-date-picker
|
|
26
|
+
v-model="queryParams[item.prop]"
|
|
27
|
+
:size="size"
|
|
28
|
+
v-bind="datePackerSetting"
|
|
29
|
+
/>
|
|
30
|
+
</template>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: 陈德立*******419287484@qq.com
|
|
3
|
+
* @Date: 2023-11-09 10:01:20
|
|
4
|
+
* @LastEditTime: 2023-11-10 16:51:18
|
|
5
|
+
* @LastEditors: 陈德立*******419287484@qq.com
|
|
6
|
+
* @Github: https://github.com/Alan1034
|
|
7
|
+
* @Description: 分割线
|
|
8
|
+
* @FilePath: \deal-front-endd:\work\GeneralBasicForm\src\components\VBasic\divider\index.vue
|
|
9
|
+
*
|
|
10
|
+
-->
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<el-divider v-bind="dividerSetting">
|
|
14
|
+
<template v-for="(templateEle, name) in item.template" #[name]>
|
|
15
|
+
<component
|
|
16
|
+
:key="name"
|
|
17
|
+
v-if="templateEle"
|
|
18
|
+
:is="currentInputComponent()"
|
|
19
|
+
:templateEle="templateEle"
|
|
20
|
+
/>
|
|
21
|
+
</template>
|
|
22
|
+
</el-divider>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
import { defineComponent } from "vue";
|
|
27
|
+
|
|
28
|
+
export default defineComponent({
|
|
29
|
+
components: {
|
|
30
|
+
slotArchive: (props) => {
|
|
31
|
+
const { templateEle } = props;
|
|
32
|
+
return templateEle();
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
props: {
|
|
36
|
+
item: null, // null就是any
|
|
37
|
+
},
|
|
38
|
+
setup() {},
|
|
39
|
+
data() {
|
|
40
|
+
return {
|
|
41
|
+
dividerSetting: {
|
|
42
|
+
...this.item.dividerSetting,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
methods: {
|
|
47
|
+
currentInputComponent() {
|
|
48
|
+
return "slot-archive";
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
</script>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-input
|
|
3
|
+
@keydown.enter="getList"
|
|
4
|
+
v-model="queryParams[item.prop]"
|
|
5
|
+
:size="size"
|
|
6
|
+
v-bind="inputSetting"
|
|
7
|
+
>
|
|
8
|
+
<template v-for="(templateEle, name) in item.template" #[name]>
|
|
9
|
+
<component
|
|
10
|
+
:key="name"
|
|
11
|
+
v-if="templateEle"
|
|
12
|
+
:is="currentInputComponent()"
|
|
13
|
+
:templateEle="templateEle"
|
|
14
|
+
/>
|
|
15
|
+
</template>
|
|
16
|
+
</el-input>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script lang="ts">
|
|
20
|
+
import { defineComponent, inject } from "vue";
|
|
21
|
+
import { inputDefaultSetting } from "../../setting";
|
|
22
|
+
export default defineComponent({
|
|
23
|
+
components: {
|
|
24
|
+
InputArchive: (props) => {
|
|
25
|
+
const { templateEle } = props;
|
|
26
|
+
return templateEle();
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
props: {
|
|
30
|
+
item: null, // null就是any
|
|
31
|
+
},
|
|
32
|
+
setup() {
|
|
33
|
+
const queryParams = inject("queryParams", {});
|
|
34
|
+
const getList = inject("getList");
|
|
35
|
+
const size = inject("size");
|
|
36
|
+
return { queryParams, getList, size };
|
|
37
|
+
},
|
|
38
|
+
data() {
|
|
39
|
+
return {
|
|
40
|
+
inputSetting: {
|
|
41
|
+
...inputDefaultSetting,
|
|
42
|
+
...this.item.inputSetting,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
// created() {
|
|
47
|
+
// console.log("new", this.item);
|
|
48
|
+
// console.log("new", this.inputSetting);
|
|
49
|
+
// },
|
|
50
|
+
methods: {
|
|
51
|
+
currentInputComponent() {
|
|
52
|
+
return "input-archive";
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
// watch: {
|
|
56
|
+
// item(val) {
|
|
57
|
+
// console.log("item", val);
|
|
58
|
+
// },
|
|
59
|
+
// size(val) {
|
|
60
|
+
// console.log(val);
|
|
61
|
+
// },
|
|
62
|
+
// },
|
|
63
|
+
});
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<style>
|
|
67
|
+
</style>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: 陈德立*******419287484@qq.com
|
|
3
|
+
* @Date: 2023-11-09 10:01:20
|
|
4
|
+
* @LastEditTime: 2023-11-16 10:52:01
|
|
5
|
+
* @LastEditors: 陈德立*******419287484@qq.com
|
|
6
|
+
* @Github: https://github.com/Alan1034
|
|
7
|
+
* @Description: 图形验证码组件
|
|
8
|
+
* @FilePath: \GeneralBasicForm\src\components\VBasic\input-graphic-verification\index.vue
|
|
9
|
+
*
|
|
10
|
+
-->
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import Input from "../input/index.vue";
|
|
14
|
+
import { inject } from "vue";
|
|
15
|
+
import { formLoadingKey } from "../../../injectKey";
|
|
16
|
+
import type {
|
|
17
|
+
BasicFormComponentsProps,
|
|
18
|
+
InputGraphicVerification,
|
|
19
|
+
} from "../../../types/componentsProps";
|
|
20
|
+
const { item } = defineProps<{ item: any }>();
|
|
21
|
+
const { graphicSrc = "", getGraphic = () => {} }: InputGraphicVerification =
|
|
22
|
+
item;
|
|
23
|
+
|
|
24
|
+
const { formLoading, updateFormLoading } = inject<any>(formLoadingKey);
|
|
25
|
+
// console.log(formLoading.value, "formLoading.value");
|
|
26
|
+
const graphicClick = async () => {
|
|
27
|
+
// console.log('click', getGraphic);
|
|
28
|
+
if (getGraphic && !formLoading.value) {
|
|
29
|
+
await getGraphic();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<div class="input-graphic-verification" v-loading="formLoading">
|
|
36
|
+
<Input :item="item" class="input" />
|
|
37
|
+
<img class="graphic" @click="graphicClick" :src="graphicSrc" />
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<style lang="less" scoped>
|
|
42
|
+
.input-graphic-verification {
|
|
43
|
+
display: flex;
|
|
44
|
+
gap: 12px;
|
|
45
|
+
width: 100%;
|
|
46
|
+
.input {
|
|
47
|
+
flex: auto;
|
|
48
|
+
}
|
|
49
|
+
.graphic {
|
|
50
|
+
width: 109px;
|
|
51
|
+
height: 43px;
|
|
52
|
+
object-fit: fill;
|
|
53
|
+
flex: none;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: 陈德立*******419287484@qq.com
|
|
3
|
+
* @Date: 2023-11-09 10:01:20
|
|
4
|
+
* @LastEditTime: 2023-11-14 15:35:16
|
|
5
|
+
* @LastEditors: 陈德立*******419287484@qq.com
|
|
6
|
+
* @Github: https://github.com/Alan1034
|
|
7
|
+
* @Description: 手机验证码组件
|
|
8
|
+
* @FilePath: \GeneralBasicForm\src\components\VBasic\input-mobile-verification\index.vue
|
|
9
|
+
*
|
|
10
|
+
-->
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import Input from "../input/index.vue";
|
|
14
|
+
import { h, watch, onBeforeUpdate, nextTick } from "vue";
|
|
15
|
+
import { BasicFormComponentsProps } from "../../../types/componentsProps";
|
|
16
|
+
import VerificationButton from "./verification-button.vue";
|
|
17
|
+
const { item } = defineProps<{item:any}>();
|
|
18
|
+
// 重新赋值一下触发下面的代码,否则响应会在内部进行
|
|
19
|
+
const mobileItem = item;
|
|
20
|
+
mobileItem.template = {
|
|
21
|
+
append: () => {
|
|
22
|
+
return h(VerificationButton, {
|
|
23
|
+
getSmscode: mobileItem.getSmscode,
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<Input :item="mobileItem" class="input"> </Input>
|
|
31
|
+
</template>
|