meixioacomponent 0.2.32 → 0.2.34

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.
@@ -1123,7 +1123,7 @@
1123
1123
  margin: 5px 0;
1124
1124
  }
1125
1125
  .el-select-dropdown.is-multiple .el-select-dropdown__item {
1126
- padding-right: 40px;
1126
+ padding-right: 0px;
1127
1127
  }
1128
1128
  .el-select-dropdown.is-multiple .el-select-dropdown__item.selected {
1129
1129
  color: var(--color-primary);
@@ -1540,7 +1540,8 @@
1540
1540
  border-color: #909399;
1541
1541
  }
1542
1542
  .el-tag.el-tag--info .el-tag__close {
1543
- color: #909399;
1543
+ color: var(--text-black) !important;
1544
+ background-color: var(--text-white) !important;
1544
1545
  }
1545
1546
  .el-tag.el-tag--info .el-tag__close:hover {
1546
1547
  color: var(--bg-white);
@@ -2014,20 +2015,7 @@
2014
2015
  overflow: hidden;
2015
2016
  text-overflow: ellipsis;
2016
2017
  }
2017
- .el-select .el-tag {
2018
- -webkit-box-sizing: border-box;
2019
- box-sizing: border-box;
2020
- border-color: transparent;
2021
- margin: 2px 0 2px 6px;
2022
- background-color: #f0f2f5;
2023
- display: -webkit-box;
2024
- display: -ms-flexbox;
2025
- display: flex;
2026
- max-width: 100%;
2027
- -webkit-box-align: center;
2028
- -ms-flex-align: center;
2029
- align-items: center;
2030
- }
2018
+
2031
2019
  .el-select .el-tag__close.el-icon-close {
2032
2020
  background-color: #8f959e;
2033
2021
  top: 0;
@@ -5846,7 +5834,7 @@
5846
5834
  margin: 5px 0;
5847
5835
  }
5848
5836
  .el-select-dropdown.is-multiple .el-select-dropdown__item {
5849
- padding-right: 40px;
5837
+ padding-right: 0px !important;
5850
5838
  }
5851
5839
  .el-select-dropdown.is-multiple .el-select-dropdown__item.selected {
5852
5840
  color: var(--color-primary);
@@ -6738,7 +6726,8 @@
6738
6726
  box-sizing: border-box;
6739
6727
  border-color: transparent;
6740
6728
  margin: 2px 0 2px 6px;
6741
- background-color: #f0f2f5;
6729
+ color: var(--text-white);
6730
+ background-color: var(--color-success);
6742
6731
  display: -webkit-box;
6743
6732
  display: -ms-flexbox;
6744
6733
  display: flex;
@@ -14522,9 +14511,7 @@
14522
14511
  .el-tag.el-tag--info.is-hit {
14523
14512
  border-color: #909399;
14524
14513
  }
14525
- .el-tag.el-tag--info .el-tag__close {
14526
- color: #909399;
14527
- }
14514
+
14528
14515
  .el-tag.el-tag--info .el-tag__close:hover {
14529
14516
  color: var(--bg-white);
14530
14517
  background-color: #909399;
@@ -15248,6 +15235,8 @@
15248
15235
  .el-tree-node {
15249
15236
  white-space: nowrap;
15250
15237
  outline: 0;
15238
+ margin: var(--margin-3) 0px;
15239
+ padding: 0px var(--padding-3);
15251
15240
  }
15252
15241
  .el-tree-node:focus > .el-tree-node__content {
15253
15242
  background-color: var(--hover-gray);
@@ -20999,9 +20988,7 @@
20999
20988
  .el-tag.el-tag--info.is-hit {
21000
20989
  border-color: #909399;
21001
20990
  }
21002
- .el-tag.el-tag--info .el-tag__close {
21003
- color: #909399;
21004
- }
20991
+
21005
20992
  .el-tag.el-tag--info .el-tag__close:hover {
21006
20993
  color: var(--bg-white);
21007
20994
  background-color: #909399;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meixioacomponent",
3
- "version": "0.2.32",
3
+ "version": "0.2.34",
4
4
  "private": false,
5
5
  "author": "YuRi",
6
6
  "main": "lib/meixioacomponent.umd.min.js",
@@ -0,0 +1,7 @@
1
+ import baseTreeSelect from "./index.vue";
2
+
3
+ baseTreeSelect.install = function (Vue) {
4
+ Vue.component(baseTreeSelect.name, baseTreeSelect);
5
+ };
6
+
7
+ export default baseTreeSelect;
@@ -0,0 +1,241 @@
1
+ <template>
2
+ <el-select
3
+ ref="select"
4
+ :value="value"
5
+ placeholder="请选择"
6
+ size="mini"
7
+ @visible-change="visibleChange"
8
+ clearable
9
+ :multiple="multiple"
10
+ style="width: 100%"
11
+ @clear="clear"
12
+ @remove-tag="removeTag"
13
+ >
14
+ <el-option
15
+ ref="option"
16
+ class="option"
17
+ :key="index"
18
+ v-for="(item, index) in optionData"
19
+ :value="item[`${nodeKey}`]"
20
+ :label="item[`${label}`]"
21
+ >
22
+ <div style="display: none"></div>
23
+ </el-option>
24
+ <el-tree
25
+ ref="tree"
26
+ class="tree"
27
+ :data="data"
28
+ :props="props"
29
+ highlight-current
30
+ :node-key="nodeKey"
31
+ :show-checkbox="multiple"
32
+ :default-expanded-keys="[value]"
33
+ :expand-on-click-node="true"
34
+ @node-click="handleNodeClick"
35
+ @check="handleNodeMultiplyClick"
36
+ ></el-tree>
37
+ </el-select>
38
+ </template>
39
+
40
+ <script>
41
+ export default {
42
+ name: "baseTreeSelect",
43
+
44
+ data() {
45
+ return {
46
+ optionData: null,
47
+ };
48
+ },
49
+ created() {
50
+ this.setOptionData();
51
+ },
52
+ mounted() {
53
+ if (!this.isEmpty(this.data)) {
54
+ this.init(this.value);
55
+ }
56
+ },
57
+ props: {
58
+ // v-model绑定
59
+ value: {
60
+ type: [String, Number, Array],
61
+ default: "",
62
+ },
63
+ // 树形的数据
64
+ data: {
65
+ type: Array,
66
+ default: function () {
67
+ return [];
68
+ },
69
+ },
70
+ // 每个树节点用来作为唯一标识的属性
71
+ nodeKey: {
72
+ type: [String, Number],
73
+ default: "id",
74
+ },
75
+ // tree的props配置
76
+ props: {
77
+ type: Object,
78
+ default: function () {
79
+ return {
80
+ label: "label",
81
+ children: "children",
82
+ };
83
+ },
84
+ },
85
+
86
+ multiple: {
87
+ type: Boolean,
88
+ default: false,
89
+ },
90
+
91
+ checkFather: {
92
+ type: Boolean,
93
+ default: false,
94
+ },
95
+ },
96
+ computed: {
97
+ label() {
98
+ return this.$props.props.label;
99
+ },
100
+ },
101
+ methods: {
102
+ // 设置optionsData
103
+ setOptionData() {
104
+ this.optionData = [];
105
+ let obj = {};
106
+ this.$set(obj, `${this.label}`, "");
107
+ this.$set(obj, `${this.$props.nodeKey}`, "");
108
+ this.optionData.push(obj);
109
+ },
110
+ // 是否为空
111
+ isEmpty(val) {
112
+ for (let key in val) {
113
+ return false;
114
+ }
115
+ return true;
116
+ },
117
+ // 当选择器为单选时调用该方法
118
+ handleNodeClick(data) {
119
+ if (this.$props.multiple) return;
120
+ let props = this.$props.props;
121
+ if (data[`${props.children}`]) {
122
+ if (this.$props.checkFather) {
123
+ this.$emit("input", data[this.nodeKey]);
124
+ this.$refs.select.visible = false;
125
+ } else {
126
+ // 当父节点不能点击时,不让它高亮
127
+ this.$refs.tree.setCurrentKey(this.value);
128
+ }
129
+ } else {
130
+ this.$emit("input", data[this.nodeKey]);
131
+ this.$refs.select.visible = false;
132
+ }
133
+ },
134
+ // 初始化并且赋值
135
+ init(val) {
136
+ // 是否是多选
137
+ if (this.multiple) {
138
+ this.setMultipleValue(val);
139
+ } else {
140
+ this.setSingleValue(val);
141
+ }
142
+ },
143
+ // 当选择框出现时
144
+ visibleChange(e) {
145
+ if (e) {
146
+ let selectDom = document.querySelector(".is-current");
147
+ this.$nextTick(() => {
148
+ this.$refs.select.scrollToOption({ $el: selectDom });
149
+ });
150
+ }
151
+ },
152
+ // 清空值
153
+ clear() {
154
+ this.$emit("input", "");
155
+ },
156
+ // 多选被选择时
157
+ handleNodeMultiplyClick(
158
+ checkedNodes,
159
+ checkedKeys,
160
+ halfCheckedNodes,
161
+ halfCheckedKeys
162
+ ) {
163
+ this.$emit("input", checkedKeys.checkedKeys);
164
+ },
165
+ // 移除tag时
166
+ removeTag(e) {
167
+ let index = this.value.findIndex((item) => {
168
+ return item == e;
169
+ });
170
+ if (index > -1) {
171
+ this.value.splice(index, 1);
172
+ }
173
+ },
174
+
175
+ // 设置多选数据
176
+ setMultipleValue(val) {
177
+ if (val.length > 0) {
178
+ this.$nextTick(() => {
179
+ let nodeKey = this.$props.nodeKey;
180
+ let label = this.label;
181
+ this.$refs.tree.setCheckedKeys(val, false);
182
+ let nodes = this.$refs.tree.getCheckedNodes();
183
+ this.optionData = [];
184
+ nodes.forEach((item) => {
185
+ let obj = {};
186
+ this.$set(obj, `${nodeKey}`, item[`${nodeKey}`]);
187
+ this.$set(obj, `${label}`, item[`${label}`]);
188
+ this.optionData.push(obj);
189
+ });
190
+ });
191
+ } else {
192
+ this.setOptionData();
193
+ this.$refs.tree.setCheckedKeys([]);
194
+ }
195
+ },
196
+
197
+ // 设置单选时的数据
198
+ setSingleValue(val) {
199
+ if (val) {
200
+ this.$nextTick(() => {
201
+ this.$refs.tree.setCurrentKey(val);
202
+ let node = this.$refs.tree.getNode(val);
203
+ this.optionData[0][`${this.$props.nodeKey}`] = val;
204
+ this.optionData[0][`${this.label}`] = node[`${this.label}`];
205
+ });
206
+ } else {
207
+ this.$refs.tree.setCurrentKey(null);
208
+ }
209
+ },
210
+ },
211
+ watch: {
212
+ value: function (val) {
213
+ if (!this.isEmpty(this.data)) {
214
+ this.init(val);
215
+ }
216
+ },
217
+ data: function (val) {
218
+ if (!this.isEmpty(val)) {
219
+ this.init(this.value);
220
+ }
221
+ },
222
+ },
223
+ };
224
+ </script>
225
+
226
+ <style lang="less" scoped>
227
+ .option {
228
+ height: auto;
229
+ line-height: 1;
230
+ padding: 0;
231
+ background-color: #fff;
232
+ }
233
+ .tree {
234
+ padding: var(--padding-2) var(--padding-2);
235
+ font-weight: var(--font-weight-g);
236
+ }
237
+
238
+ /deep/ .el-select-dropdown__item {
239
+ padding: 0px !important;
240
+ }
241
+ </style>
@@ -33,6 +33,7 @@ import baseProTable from "./proPageTable/index";
33
33
  import baseMoverVerifiBar from "./base/baseMoverVerifiBar";
34
34
  import baseTimeLine from "./base/baseTimeLine";
35
35
  import basePopoverButton from "./base/basePopoverButton";
36
+ import baseTreeSelect from "./base/baseTreeSelect";
36
37
  // js 文件相关
37
38
  import Theme from "../config/theme/theme";
38
39
  import DynamicMount from "./dynamicmount/index.js";
@@ -80,6 +81,7 @@ const meixicomponents = [
80
81
  baseMoverVerifiBar,
81
82
  baseTimeLine,
82
83
  basePopoverButton,
84
+ baseTreeSelect
83
85
  ];
84
86
 
85
87
  const install = (Vue) => {
@@ -132,6 +134,7 @@ export default {
132
134
  baseMoverVerifiBar,
133
135
  baseTimeLine,
134
136
  basePopoverButton,
137
+ baseTreeSelect,
135
138
  Theme,
136
139
  SelectStore,
137
140
  useImg,
@@ -15,7 +15,7 @@
15
15
  >
16
16
  <div
17
17
  :key="item.key"
18
- v-for="item in formArray"
18
+ v-for="item in module"
19
19
  class="dialog-form-content-item"
20
20
  >
21
21
  <div class="content-item-header">
@@ -27,13 +27,24 @@
27
27
  :size="size"
28
28
  :footer="false"
29
29
  :formConfig="item"
30
+ :disables="disables"
30
31
  :labelWidth="labelWidth"
31
- :formList="item.formList"
32
+ v-model="item.formList"
32
33
  :rules="returnRules(item.key)"
33
34
  :labelPosition="setLabelPosition(item.formType)"
34
35
  :formType="item.formType ? item.formType : 'default'"
35
36
  ref="proFormVue"
36
- ></pro_formVue>
37
+ @disableWatcherResult="disableWatcherResult"
38
+ >
39
+ <template v-for="slotItem in slotList">
40
+ <template :slot="`form-${slotItem}`">
41
+ <slot
42
+ :scope="item.formList"
43
+ :name="`formslot-${slotItem}`"
44
+ ></slot>
45
+ </template>
46
+ </template>
47
+ </pro_formVue>
37
48
  </div>
38
49
  </div>
39
50
  </div>
@@ -50,9 +61,19 @@ import baseButtonHandleVue from "../../base/baseButtonHandle/baseButtonHandle.vu
50
61
  export default {
51
62
  name: "baseDialogForm",
52
63
  data() {
53
- return {};
64
+ return {
65
+ slotList: [],
66
+ };
54
67
  },
68
+ created() {
69
+ this.createSlots();
70
+ },
71
+ mounted() {},
55
72
  props: {
73
+ disables: {
74
+ type: Object,
75
+ },
76
+ // 距离顶部的距离
56
77
  top: {
57
78
  type: Number,
58
79
  default: () => {
@@ -74,7 +95,7 @@ export default {
74
95
  require: true,
75
96
  },
76
97
  // 需要渲染的数据
77
- formArray: {
98
+ value: {
78
99
  type: Array,
79
100
  require: true,
80
101
  },
@@ -101,7 +122,55 @@ export default {
101
122
  pro_formVue,
102
123
  baseButtonHandleVue,
103
124
  },
125
+ computed: {
126
+ module: {
127
+ set(val) {
128
+ this.$emit("input", val);
129
+ },
130
+ get() {
131
+ return this.$props.value;
132
+ },
133
+ },
134
+ },
104
135
  methods: {
136
+ createSlots() {
137
+ for (let i = 0; i < this.module.length; i++) {
138
+ let item = this.module[i];
139
+ for (let j = 0; j < item.formList.length; j++) {
140
+ let citem = item.formList[j];
141
+ if (citem.type == "template") {
142
+ this.slotList.push(citem.key);
143
+ }
144
+ }
145
+ }
146
+ },
147
+
148
+ disableWatcherResult(params) {
149
+ const { result, type, key } = params;
150
+ let index = 0;
151
+ let cindex = -1;
152
+
153
+ for (let i = 0; i < this.module.length; i++) {
154
+ let item = this.module[i];
155
+ for (let j = 0; j < item.formList.length; j++) {
156
+ let citem = item.formList[j];
157
+ if (citem.key == key) {
158
+ index = i;
159
+ cindex = j;
160
+ break;
161
+ }
162
+ }
163
+ }
164
+
165
+ if (cindex > -1) {
166
+ let formItem = this.module[index].formList[cindex];
167
+ if (type == "hide") {
168
+ this.$set(formItem, "renderHide", result);
169
+ } else if (type == "disable") {
170
+ this.$set(formItem, "disabled", result);
171
+ }
172
+ }
173
+ },
105
174
  setLabelPosition(type) {
106
175
  if (!type) {
107
176
  return "right";
@@ -127,9 +196,9 @@ export default {
127
196
 
128
197
  getFormValue() {
129
198
  let obj = {};
130
- for (let i = 0; i < this.formArray.length; i++) {
199
+ for (let i = 0; i < this.module.length; i++) {
131
200
  let result = this.$refs.proFormVue[i].returnFormValue();
132
- obj[`${this.formArray[i].key}`] = result;
201
+ obj[`${this.module[i].key}`] = result;
133
202
  }
134
203
  return obj;
135
204
  },
@@ -20,7 +20,7 @@ export default {
20
20
  <style lang="less" scoped>
21
21
  .form-item-skeleton-wrap {
22
22
  width: 100%;
23
- height: 100%;
23
+ height: 60px;
24
24
  display: flex;
25
25
  align-items: center;
26
26
  flex-flow: row nowrap;
@@ -31,7 +31,7 @@ export default {
31
31
  margin-right: var(--margin-5);
32
32
  }
33
33
  .skeleton-right {
34
- height: 60px;
34
+ height: 100%;
35
35
  width: calc(70% - 10px);
36
36
  }
37
37
  }