Skip to content

Commit 2c511d8

Browse files
committed
添加From 事件
添加From 验证规则原生自定义方法
1 parent dc90f41 commit 2c511d8

File tree

13 files changed

+174
-46
lines changed

13 files changed

+174
-46
lines changed

public/app.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,11 @@ __webpack_require__.r(__webpack_exports__);
991991
}).then(function (_ref) {
992992
var data = _ref.data;
993993
_this.formData = data;
994-
_this.init = true;
994+
_this.init = true; //发送表单编辑数据加载完毕事件
995+
996+
_this.$nextTick(function () {
997+
_this.$bus.emit("EditDataLoadingCompleted");
998+
});
995999
})["finally"](function () {
9961000
_this.loading = false;
9971001
});
@@ -2850,7 +2854,6 @@ __webpack_require__.r(__webpack_exports__);
28502854
//
28512855
//
28522856
//
2853-
//
28542857

28552858
/* harmony default export */ __webpack_exports__["default"] = ({
28562859
props: {
@@ -3162,6 +3165,7 @@ __webpack_require__.r(__webpack_exports__);
31623165
/* harmony default export */ __webpack_exports__["default"] = ({
31633166
props: {
31643167
attrs: Object,
3168+
form_data: Object,
31653169
value: {
31663170
"default": null
31673171
}
@@ -3662,6 +3666,11 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
36623666
//
36633667
//
36643668
//
3669+
//
3670+
//
3671+
//
3672+
//
3673+
//
36653674

36663675
/* harmony default export */ __webpack_exports__["default"] = ({
36673676
props: ["attrs", "value", "form_data"],
@@ -5688,7 +5697,7 @@ exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loa
56885697

56895698

56905699
// module
5691-
exports.push([module.i, "#app,\nbody,\nhtml {\n height: 100%;\n}\n\nbody {\n background-color: #f7f7f7;\n font-size: 14px;\n}\n\n.ml-2 {\n margin-left: 2px;\n}\n\n.ml-5 {\n margin-left: 5px;\n}\n\n.mr-5 {\n margin-right: 5px;\n}\n\n.ml-10 {\n margin-left: 10px;\n}\n\n.mr-10 {\n margin-right: 10px;\n}\n\n.mb-15 {\n margin-bottom: 15px;\n}\n\n.ml-20 {\n margin-left: 20px;\n}\n\n.mt-30 {\n margin-top: 30px;\n}\n\n.mt-50 {\n margin-top: 50px;\n}\n\n.fs-12 {\n font-size: 12px;\n}\n\n.fs-14 {\n font-size: 14px;\n}\n\n.fs-16 {\n font-size: 16px;\n}\n\n.fs-18 {\n font-size: 18px;\n}\n\n.fs-20 {\n font-size: 20px;\n}\n\n.fs-22 {\n font-size: 22px;\n}\n\n.fs-24 {\n font-size: 24px;\n}\n\n.fs-25 {\n font-size: 25px;\n}\n\n.hover {\n cursor: pointer;\n}\n\n.flex-c {\n display: flex;\n align-items: center;\n}\n\n.flex-c-sb {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n/**********************************/\n.page-account {\n display: flex;\n flex-direction: column;\n height: 100vh;\n overflow: auto;\n}\n\n.el-card {\n border: none;\n}\n\n.el-popconfirm__main {\n margin: 10px 0;\n}\n\n.el-image-viewer__close {\n color: white;\n}\n\n.el-upload-list__item img {\n object-fit: cover;\n}\n\n.el-select-dropdown__item {\n padding: 0 10px;\n}\n\n/*************************************************/\n/*fade*/\n.fade-enter-active,\n.fade-leave-active {\n -webkit-transition: opacity 0.1s;\n transition: opacity 0.1s;\n}\n\n.fade-enter,\n.fade-leave-active {\n opacity: 0;\n}\n\n/*fade-transform*/\n.fade-transform-leave-active,\n.fade-transform-enter-active {\n -webkit-transition: all 0.5s;\n transition: all 0.5s;\n}\n\n.fade-transform-enter {\n opacity: 0;\n -webkit-transform: translateX(-20px);\n transform: translateX(-20px);\n}\n\n.fade-transform-leave-to {\n opacity: 0;\n -webkit-transform: translateX(20px);\n transform: translateX(20px);\n}", ""]);
5700+
exports.push([module.i, "#app,\nbody,\nhtml {\n height: 100%;\n}\n\nbody {\n background-color: #f7f7f7;\n font-size: 14px;\n}\n\n.ml-2 {\n margin-left: 2px;\n}\n\n.ml-5 {\n margin-left: 5px;\n}\n\n.mr-5 {\n margin-right: 5px;\n}\n\n.mt-5 {\n margin-top: 5px;\n}\n\n.ml-10 {\n margin-left: 10px;\n}\n\n.mr-10 {\n margin-right: 10px;\n}\n\n.mb-10 {\n margin-bottom: 10px;\n}\n\n.mt-10 {\n margin-top: 10px;\n}\n\n.mb-15 {\n margin-bottom: 15px;\n}\n\n.ml-20 {\n margin-left: 20px;\n}\n\n.mt-30 {\n margin-top: 30px;\n}\n\n.mt-50 {\n margin-top: 50px;\n}\n\n.fs-12 {\n font-size: 12px;\n}\n\n.fs-14 {\n font-size: 14px;\n}\n\n.fs-16 {\n font-size: 16px;\n}\n\n.fs-18 {\n font-size: 18px;\n}\n\n.fs-20 {\n font-size: 20px;\n}\n\n.fs-22 {\n font-size: 22px;\n}\n\n.fs-24 {\n font-size: 24px;\n}\n\n.fs-25 {\n font-size: 25px;\n}\n\n.hover {\n cursor: pointer;\n}\n\n.flex {\n display: flex;\n flex-wrap: wrap;\n}\n\n.flex-c {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n}\n\n.flex-c-c {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-wrap: wrap;\n}\n\n.flex-c-sb {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n}\n\n.flex-1 {\n flex: 1;\n}\n\n/**********************************/\n.page-account {\n display: flex;\n flex-direction: column;\n height: 100vh;\n overflow: auto;\n}\n\n.el-card {\n border: none;\n}\n\n.el-popconfirm__main {\n margin: 10px 0;\n}\n\n.el-image-viewer__close {\n color: white;\n}\n\n.el-upload-list__item img {\n object-fit: cover;\n}\n\n.el-select-dropdown__item {\n padding: 0 10px;\n}\n\n/*************************************************/\n/*fade*/\n.fade-enter-active,\n.fade-leave-active {\n -webkit-transition: opacity 0.1s;\n transition: opacity 0.1s;\n}\n\n.fade-enter,\n.fade-leave-active {\n opacity: 0;\n}\n\n/*fade-transform*/\n.fade-transform-leave-active,\n.fade-transform-enter-active {\n -webkit-transition: all 0.5s;\n transition: all 0.5s;\n}\n\n.fade-transform-enter {\n opacity: 0;\n -webkit-transform: translateX(-20px);\n transform: translateX(-20px);\n}\n\n.fade-transform-leave-to {\n opacity: 0;\n -webkit-transform: translateX(20px);\n transform: translateX(20px);\n}", ""]);
56925701

56935702
// exports
56945703

@@ -5878,7 +5887,7 @@ exports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-
58785887

58795888

58805889
// module
5881-
exports.push([module.i, ".upload-component {\n display: flex;\n flex-wrap: wrap;\n}\n.upload-component .upload-images {\n display: flex;\n flex-wrap: wrap;\n}\n.upload-component .upload-images .upload-images-item {\n margin-right: 10px;\n position: relative;\n line-height: 1;\n}\n.upload-component .upload-images .upload-images-item img {\n line-height: 1;\n vertical-align: middle;\n}\n.upload-component .upload-images .upload-images-item .el-image {\n cursor: zoom-in;\n}\n.upload-component .upload-images .upload-images-item .el-icon-document-checked {\n font-size: 30px;\n}\n.upload-component .upload-images .upload-images-item .mask {\n position: absolute;\n transition: all 0.3s ease-in-out;\n opacity: 0;\n background: rgba(0, 0, 0, 0.3);\n color: white;\n font-size: 20px;\n padding: 5px;\n top: 50%;\n left: 50%;\n cursor: pointer;\n transform: translate(-50%, -50%);\n}\n.upload-component .upload-images .upload-images-item:hover .mask {\n opacity: 1;\n}\n.upload-component .upload-block .el-upload-dragger {\n width: unset;\n height: unset;\n border: none;\n border-radius: 0;\n}\n.upload-component .upload-block .avatar {\n border-radius: 50%;\n}\n.upload-component .upload-block .image,\n.upload-component .upload-block .file {\n border-radius: 0;\n}", ""]);
5890+
exports.push([module.i, ".upload-component {\n display: flex;\n flex-wrap: wrap;\n}\n.upload-component .upload-images {\n display: flex;\n flex-wrap: wrap;\n}\n.upload-component .upload-images .upload-images-item + .upload-images-item {\n margin-right: 10px;\n}\n.upload-component .upload-images .upload-images-item {\n position: relative;\n line-height: 1;\n}\n.upload-component .upload-images .upload-images-item img {\n line-height: 1;\n vertical-align: middle;\n}\n.upload-component .upload-images .upload-images-item .el-image {\n cursor: zoom-in;\n}\n.upload-component .upload-images .upload-images-item .el-icon-document-checked {\n font-size: 30px;\n}\n.upload-component .upload-images .upload-images-item .mask {\n position: absolute;\n transition: all 0.3s ease-in-out;\n opacity: 0;\n background: rgba(0, 0, 0, 0.3);\n color: white;\n font-size: 20px;\n padding: 5px;\n top: 50%;\n left: 50%;\n cursor: pointer;\n transform: translate(-50%, -50%);\n}\n.upload-component .upload-images .upload-images-item:hover .mask {\n opacity: 1;\n}\n.upload-component .upload-images .upload-show-image {\n border: 1px solid #dcdfe6;\n padding: 2px;\n}\n.upload-component .upload-block .el-upload-dragger {\n width: unset;\n height: unset;\n border: none;\n border-radius: 0;\n}\n.upload-component .upload-block .avatar {\n border-radius: 50%;\n}\n.upload-component .upload-block .image,\n.upload-component .upload-block .file {\n border-radius: 0;\n}", ""]);
58825891

58835892
// exports
58845893

@@ -29645,8 +29654,7 @@ var render = function() {
2964529654
lazy: _vm.attrs.lazy,
2964629655
src: _vm.src,
2964729656
"scroll-container": _vm.attrs.scrollContainer,
29648-
"preview-src-list": _vm.previewSrcList,
29649-
"z-index": _vm.attrs.zIndex
29657+
"preview-src-list": _vm.previewSrcList
2965029658
}
2965129659
})
2965229660
}
@@ -30366,6 +30374,7 @@ var render = function() {
3036630374
[
3036730375
_vm.attrs.type == "image"
3036830376
? _c("el-image", {
30377+
staticClass: "upload-show-image",
3036930378
style: {
3037030379
width: _vm.attrs.width + "px",
3037130380
height: _vm.attrs.height + "px"
@@ -30416,7 +30425,10 @@ var render = function() {
3041630425
_vm.list.length < _vm.attrs.limit
3041730426
? _c(
3041830427
"div",
30419-
{ staticClass: "upload-block" },
30428+
{
30429+
staticClass: "upload-block",
30430+
class: { "ml-10": _vm.attrs.multiple }
30431+
},
3042030432
[
3042130433
_c(
3042230434
"el-upload",

public/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"/app.js": "/app.js?id=74fda92e3b50a4dc4b6a",
2+
"/app.js": "/app.js?id=551734fe1281fd9942a3",
33
"/manifest.js": "/manifest.js?id=d9708e48a6c10ccee4bb",
44
"/vendor.js": "/vendor.js?id=f4679ac178c0e413cb28"
55
}

resources/js/components/form/BaseForm.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,12 @@ export default {
133133
})
134134
.then(({ data }) => {
135135
this.formData = data;
136-
137136
this.init = true;
137+
138+
//发送表单编辑数据加载完毕事件
139+
this.$nextTick(() => {
140+
this.$bus.emit("EditDataLoadingCompleted");
141+
});
138142
})
139143
.finally(() => {
140144
this.loading = false;

resources/js/components/widgets/Image.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
:src="src"
88
:scroll-container="attrs.scrollContainer"
99
:preview-src-list="previewSrcList"
10-
:z-index="attrs.zIndex"
1110
/>
1211
</template>
1312
<script>

resources/js/components/widgets/Select.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
:value="item.value"
3434
:disabled="item.disabled"
3535
>
36-
36+
3737
<div class="flex-c-sb">
3838
<div class="flex-c">
3939
<el-avatar
@@ -53,6 +53,7 @@
5353
export default {
5454
props: {
5555
attrs: Object,
56+
form_data:Object,
5657
value: {
5758
default: null
5859
}

resources/js/components/widgets/Upload.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
:src="item.url"
1010
:style="{ width: attrs.width + 'px', height: attrs.height + 'px' }"
1111
fit="cover"
12+
class="upload-show-image"
1213
:preview-src-list="urlList"
1314
/>
1415
<el-avatar
@@ -32,7 +33,11 @@
3233
</div>
3334
</template>
3435
</div>
35-
<div class="upload-block" v-if="list.length < attrs.limit">
36+
<div
37+
class="upload-block"
38+
:class="{ 'ml-10': attrs.multiple }"
39+
v-if="list.length < attrs.limit"
40+
>
3641
<el-upload
3742
:style="attrs.style"
3843
:class="attrs.className"
@@ -191,8 +196,10 @@ export default {
191196
.upload-images {
192197
display: flex;
193198
flex-wrap: wrap;
194-
.upload-images-item {
199+
.upload-images-item + .upload-images-item {
195200
margin-right: 10px;
201+
}
202+
.upload-images-item {
196203
position: relative;
197204
line-height: 1;
198205
@@ -225,6 +232,10 @@ export default {
225232
}
226233
}
227234
}
235+
.upload-show-image {
236+
border: 1px solid #dcdfe6;
237+
padding: 2px;
238+
}
228239
}
229240
.upload-block {
230241
.el-upload-dragger {

resources/js/styles/admin.scss

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@ body {
1616
.ml-5 {
1717
margin-left: 5px;
1818
}
19-
.mr-5{
19+
20+
.mr-5 {
2021
margin-right: 5px;
2122
}
23+
.mt-5{
24+
margin-top: 5px;
25+
}
26+
2227
.ml-10 {
2328
margin-left: 10px;
2429
}
@@ -27,6 +32,14 @@ body {
2732
margin-right: 10px;
2833
}
2934

35+
.mb-10 {
36+
margin-bottom: 10px;
37+
}
38+
39+
.mt-10 {
40+
margin-top: 10px;
41+
}
42+
3043
.mb-15 {
3144
margin-bottom: 15px;
3245
}
@@ -79,18 +92,34 @@ body {
7992
cursor: pointer;
8093
}
8194

82-
95+
.flex {
96+
display: flex;
97+
flex-wrap: wrap;
98+
}
8399

84100
.flex-c {
85101
display: flex;
86102
align-items: center;
103+
flex-wrap: wrap;
104+
}
105+
106+
.flex-c-c {
107+
display: flex;
108+
align-items: center;
109+
justify-content: center;
110+
flex-wrap: wrap;
87111
}
88112

89113

90114
.flex-c-sb {
91115
display: flex;
92116
align-items: center;
93117
justify-content: space-between;
118+
flex-wrap: wrap;
119+
}
120+
121+
.flex-1 {
122+
flex: 1;
94123
}
95124

96125

@@ -120,7 +149,8 @@ body {
120149
object-fit: cover;
121150
}
122151
}
123-
.el-select-dropdown__item{
152+
153+
.el-select-dropdown__item {
124154
padding: 0 10px;
125155
}
126156

src/Components/Component.php

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
namespace SmallRuralDog\Admin\Components;
55

66

7-
class Component implements \JsonSerializable
7+
use SmallRuralDog\Admin\Traits\AdminJsonBuilder;
8+
9+
class Component extends AdminJsonBuilder
810
{
911
protected $componentName = "";
1012
protected $className;
1113
protected $style;
1214
protected $componentValue;
1315

14-
protected $hideAttrs = [];
1516

1617
public function __construct($value = null)
1718
{
@@ -57,20 +58,4 @@ public function getComponentValue()
5758
}
5859

5960

60-
/**
61-
* @inheritDoc
62-
*/
63-
public function jsonSerialize()
64-
{
65-
$data = [];
66-
67-
$hide = collect($this->hideAttrs)->push("hideAttrs")->toArray();
68-
69-
foreach ($this as $key => $val) {
70-
if (!in_array($key, $hide)) {
71-
$data[$key] = $val;
72-
}
73-
}
74-
return $data;
75-
}
7661
}

src/Components/WangEditor.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ class WangEditor extends Component
3838

3939
protected $uploadImgServer;
4040

41-
protected $hideAttrs = [];
42-
4341
static public function make($value = null)
4442
{
4543
return new Wangeditor($value);
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<template>
2+
</template>
3+
<script>
4+
export default {
5+
props: {
6+
attrs: Object,
7+
form_data: Object,
8+
value: {
9+
default: null
10+
}
11+
},
12+
data() {
13+
return {
14+
options: this.attrs.options
15+
};
16+
},
17+
model: {
18+
prop: "value",
19+
event: "change"
20+
},
21+
methods: {
22+
onChange(value) {
23+
this.$emit("change", value);
24+
}
25+
}
26+
};
27+
</script>

0 commit comments

Comments
 (0)