gyyg-components 0.2.8 → 0.2.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gyyg-components",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "private": false,
5
5
  "main": "lib/gyyg-components.umd.js",
6
6
  "scripts": {
@@ -14,6 +14,7 @@
14
14
  "core-js": "^3.6.5",
15
15
  "element-resize-detector": "^1.2.4",
16
16
  "element-ui": "2.15.6",
17
+ "sortablejs": "^1.15.6",
17
18
  "vue": "^2.6.11"
18
19
  },
19
20
  "devDependencies": {
package/src/App.vue CHANGED
@@ -13,8 +13,9 @@
13
13
  @show="show"
14
14
  ></mec-input-table>-->
15
15
  <!-- <mec-form :formData="formData" :showBtn="true" @submit="submit"></mec-form> -->
16
- <mec-search-form :formGroups="formGroups"></mec-search-form>
17
16
 
17
+ <mec-form ref="planForm" :formData="formData" :label-width="'100px'"></mec-form>
18
+ <mec-popover-button :btnInfo="btnInfo"></mec-popover-button>
18
19
  </div>
19
20
  </template>
20
21
 
@@ -23,27 +24,36 @@ export default {
23
24
  data() {
24
25
  const _this = this;
25
26
  return {
26
- formGroups: {
27
- abLifeSupport: {
28
- componentName: 'mec-radio',
29
- label: '生命支持',
30
- labelWidth: "100px",
31
- options: [
32
- {
33
- label: '是',
34
- value: true
27
+ formData:{
28
+ // 日期组件
29
+ wpaApplicationDate: {
30
+ label: '申请日期',
31
+ componentName: 'mec-date-picker',
32
+ placeholder: '请选择日期',
33
+ dateType: 'datetime',
34
+ col: 12,
35
+ valueFormat: 'yyyy-MM-dd HH:mm:ss',
36
+ value: '',
37
+ rules: [{ required: true, message: '请选择日期', trigger: 'change' }],
35
38
  },
36
- {
37
- label: '否',
38
- value: false
39
- },
40
- ],
41
- value: '',
42
- }
39
+ },
40
+ btnInfo: {
41
+ text: '操作',
42
+ type: 'primary',
43
+ disabled: false,
44
+ hasPermi: '',
45
+ options: [
46
+ { id: '1', label: '选项1', hasPermi: '' },
47
+ { id: '2', label: '选项2', hasPermi: '' },
48
+ { id: '3', label: '选项3' }
49
+ ]
43
50
  }
44
51
  };
45
52
  },
46
53
  methods: {
54
+ handleEnter() {
55
+ console.log('enter');
56
+ },
47
57
  },
48
58
  // methods: {
49
59
  // handleRowClick(row) {
@@ -187,7 +187,7 @@ export default {
187
187
  }
188
188
  </script>
189
189
 
190
- <style lang="less">
190
+ <style lang="less" scoped>
191
191
  .el-dialog__wrapper {
192
192
  overflow: hidden;
193
193
  display: flex;
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <div class="btn-group">
3
- <div v-for="btn in btnList" :key="btn.id">
3
+ <div v-for="btn in btnList" :key="btn.id"
4
+ v-has-permi="btn.hasPermi ? [btn.hasPermi] : undefined">
4
5
  <el-button
5
6
  v-if="!btn['componentType']"
6
- v-has-permi="[btn.hasPermi]"
7
7
  :disabled="btn.disabled"
8
- :size="btn.size"
8
+ :size="btn.size || 'small'"
9
9
  :type="btn.type"
10
10
  :icon="!btn.rightIcon ? btn.icon: ''"
11
11
  :loading="btn.loading"
@@ -20,7 +20,6 @@
20
20
  ></component>
21
21
  </div>
22
22
  </div>
23
-
24
23
  </div>
25
24
  </template>
26
25
  <script>
@@ -50,8 +49,11 @@ export default {
50
49
  align-items: center;
51
50
  flex-wrap: wrap;
52
51
  &>div {
53
- margin-left: 15px;
54
- margin-bottom: 15px;
52
+ margin-left: 5px;
53
+ margin-bottom: 10px;
54
+ &:first-child {
55
+ margin-left: 0;
56
+ }
55
57
  }
56
58
  }
57
59
  </style>
@@ -20,7 +20,7 @@
20
20
  :modal='modal'
21
21
  >
22
22
  <slot name="body" />
23
- <div v-if="footer" slot="footer" class="dialog-footer">
23
+ <div v-if="footer" slot="footer">
24
24
  <slot name="footer" />
25
25
  </div>
26
26
  </el-dialog>
@@ -129,7 +129,7 @@ export default {
129
129
  .base-dialog {
130
130
  text-align: left;
131
131
  }
132
- .el-dialog__wrapper {
132
+ /deep/.el-dialog__wrapper {
133
133
  overflow: hidden;
134
134
  display: flex;
135
135
  justify-content: center;
@@ -165,13 +165,12 @@ export default {
165
165
  flex: 1;
166
166
  overflow: auto;
167
167
  padding: 20px;
168
+ padding-bottom: 52px;
168
169
  }
169
170
 
170
171
  .el-dialog__footer {
171
- flex-shrink: 0;
172
- box-sizing: content-box;
173
- height: 32px;
174
- padding: 10px;
172
+ box-sizing: border-box;
173
+ padding: 10px 20px;
175
174
  border: none;
176
175
  background-color: #efefef;
177
176
  border-bottom-left-radius: 8px;
@@ -12,7 +12,11 @@
12
12
  :style="item.style"
13
13
  :key="index"
14
14
  >
15
- <el-form-item v-bind="item" :prop="getProp(item, index)" :rules="item.rules" :class="item.class">
15
+ <el-form-item v-bind="item" :prop="getProp(item, index)"
16
+ :rules="item.rules"
17
+ :class="item.class"
18
+ :label-width="item.labelWidth"
19
+ :style="item.labelWidth ? 'width: calc(100% - ' + labelWidth + ');' : ''">
16
20
  <template slot="label">
17
21
  <span v-if="item.label">
18
22
  {{ item.label }}
@@ -73,5 +77,10 @@ export default {
73
77
  },
74
78
  };
75
79
  </script>
76
- <style lang="less">
80
+ <style lang="less" scoped>
81
+ ::v-deep.el-form::after {
82
+ content: "";
83
+ display: table;
84
+ clear: both;
85
+ }
77
86
  </style>
@@ -15,6 +15,7 @@
15
15
  :autosize="autosize"
16
16
  @input="handleInput"
17
17
  @clear="clear"
18
+ @keyup.enter.native="handleEnter"
18
19
  >
19
20
  <div slot="prepend" v-if="prependText" @click="btnClick" :style="disabled ? 'cursor: not-allowed' : 'cursor: pointer'">{{ prependText }}</div>
20
21
  <div slot="append" v-if="appendText" @click="btnClick" :style="disabled ? 'cursor: not-allowed' : 'cursor: pointer'">{{ appendText }}</div>
@@ -130,15 +131,16 @@
130
131
  value = value.replace(/[^a-zA-Z\s]/g, '');
131
132
  }
132
133
  this.inputValue = value
133
- console.log(this.inputType);
134
134
  this.$emit('input', value);
135
135
  },
136
136
  clear() {
137
137
  this.$emit('clear')
138
138
  },
139
139
  btnClick() {
140
- console.log(123)
141
140
  this.$emit('btnClick')
141
+ },
142
+ handleEnter() {
143
+ this.$emit('enter')
142
144
  }
143
145
  },
144
146
  watch: {
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <div class="popover-button" v-has-permi="[btnInfo.hasPermi]">
2
+ <div class="popover-button" v-has-permi="btnInfo.hasPermi ? [btnInfo.hasPermi] : undefined">
3
3
  <el-dropdown
4
- :size="btnInfo.size"
4
+ :size="btnInfo.size || 'small'"
5
5
  split-button
6
6
  :type="btnInfo.type"
7
7
  :disabled="btnInfo.disabled"
@@ -15,8 +15,9 @@
15
15
  <el-dropdown-item
16
16
  v-for="item in btnInfo.options"
17
17
  :key="item.id"
18
+ :icon="item.icon || ''"
18
19
  :command="item"
19
- v-has-permi="[item.hasPermi]"
20
+ v-has-permi="item.hasPermi ? [item.hasPermi] : undefined"
20
21
  >{{ item.label }}</el-dropdown-item>
21
22
  </el-dropdown-menu>
22
23
  </el-dropdown>
@@ -25,7 +26,7 @@
25
26
  <script>
26
27
  export default {
27
28
  name: 'MecPopoverButton',
28
- props: ['btnInfo'],
29
+ props: ['btnInfo'],
29
30
  methods: {
30
31
  clickEvent(){
31
32
  if(this.btnInfo.trigger) {
@@ -45,4 +46,23 @@ export default {
45
46
  left: 65% !important;
46
47
  }
47
48
  }
49
+ /deep/ .el-dropdown__icon {
50
+ font-size: 11px
51
+ }
52
+ // /deep/ .el-dropdown-menu__item {
53
+ // background-color: #ecf5ff;
54
+ // color: #66b1ff;
55
+ // margin-top: 4px;
56
+ // }
57
+ /deep/ .el-dropdown.is-plain {
58
+ .el-button {
59
+ color: #409EFF;
60
+ background: #ecf5ff;
61
+ border-color: #b3d8ff;
62
+ }
63
+ .el-dropdown__caret-button::before {
64
+ background: #b3d8ff;
65
+ }
66
+ }
67
+
48
68
  </style>
@@ -20,8 +20,9 @@
20
20
  </template>
21
21
  <slot name="custom" :formGroups="formGroups"></slot>
22
22
  <el-form-item>
23
- <el-button type="primary" @click="search" style="margin-top: 5px">查询</el-button>
24
- <el-button type="info" icon="el-icon-refresh" @click="refresh" style="margin-top: 5px"></el-button>
23
+ <el-button type="primary" size="small" @click="search">查询</el-button>
24
+ <el-button type="primary" v-if="isSeniorBtn" size="small" @click="seniorSearch" style="margin-left: 5px;">高级搜索</el-button>
25
+ <el-button size="small" icon="el-icon-refresh" @click="refresh" style="margin-left: 5px;"></el-button>
25
26
  </el-form-item>
26
27
  </el-form>
27
28
  </div>
@@ -29,7 +30,13 @@
29
30
  <script>
30
31
  export default {
31
32
  name: 'MecSearchForm',
32
- props: ['formGroups'],
33
+ props: {
34
+ formGroups: {},
35
+ isSeniorBtn: {
36
+ type: Boolean,
37
+ default: false
38
+ }
39
+ },
33
40
  methods: {
34
41
 
35
42
  getProp(item, index) {
@@ -45,6 +52,9 @@ export default {
45
52
  },
46
53
  refresh() {
47
54
  this.$emit('refresh')
55
+ },
56
+ seniorSearch() {
57
+ this.$emit('seniorSearch')
48
58
  }
49
59
  }
50
60
  }
@@ -53,4 +63,9 @@ export default {
53
63
  /deep/ .el-form-item__content {
54
64
  width: 100%;
55
65
  }
66
+ /deep/ .el-form--inline .el-form-item {
67
+ margin-bottom: 8px;
68
+ margin-right: 5px;
69
+ vertical-align: middle;
70
+ }
56
71
  </style>
@@ -99,9 +99,17 @@ export default {
99
99
  },
100
100
  mounted() {
101
101
  if (!Array.isArray(this.options) && this.options) {
102
- this.options().then(val => {
103
- this.option = val.data || val;
104
- });
102
+ if(this.options instanceof Promise) {
103
+ this.options.then(val => {
104
+ this.option = val.data || val;
105
+ });
106
+ }
107
+ if(typeof this.options == 'function') {
108
+ this.options().then(val => {
109
+ this.option = val.data || val;
110
+ });
111
+ }
112
+
105
113
  } else {
106
114
  this.option = this.options;
107
115
  }
@@ -19,6 +19,7 @@
19
19
  :default-expand-all="defaultExpandAll"
20
20
  @row-click="rowClickHandel"
21
21
  @row-dblclick="rowDblclickHandel"
22
+ :border="border"
22
23
  >
23
24
  <!-- 多选框 -->
24
25
  <el-table-column
@@ -150,7 +151,7 @@ export default {
150
151
  required: false,
151
152
  default: () => {
152
153
  return {
153
- backgroundColor: "#fff",
154
+ backgroundColor: "#EFF3F8",
154
155
  }
155
156
  }
156
157
  },
@@ -183,7 +184,12 @@ export default {
183
184
  // 是否只选中当前行
184
185
  toggleRow: {
185
186
  default: false
187
+ },
188
+ border: {
189
+ type: Boolean,
190
+ default: true
186
191
  }
192
+
187
193
  },
188
194
  data() {
189
195
  return {
@@ -258,4 +264,7 @@ export default {
258
264
  text-align: right;
259
265
  height: 35px;
260
266
  }
267
+ /deep/ .el-table td.el-table__cell {
268
+ border-right: none;
269
+ }
261
270
  </style>
@@ -0,0 +1,6 @@
1
+
2
+ import MecTransferDrag from "./MecTransferDrag.vue";
3
+
4
+ MecTransferDrag.install = Vue => Vue.component(MecTransferDrag.name, MecTransferDrag); //注册组件
5
+
6
+ export default MecTransferDrag;
@@ -0,0 +1,147 @@
1
+ <template>
2
+ <el-transfer
3
+ v-model="rightData"
4
+ :data="data"
5
+ :titles=titles
6
+ :left-default-checked="leftDefaultChecked"
7
+ :right-default-checked="rightDefaultChecked"
8
+ :props="props"
9
+ @change="handelChange"
10
+ :target-order="targetOrder"
11
+ :filterable="filterable"
12
+ :filter-placeholder="filterPlaceholder"
13
+ @filter-method="filterMethod"
14
+ >
15
+ </el-transfer>
16
+ </template>
17
+ </template>
18
+ <script>
19
+ import Sortable from 'sortablejs';
20
+ export default {
21
+ name: 'mec-transfer-drag',
22
+ props: {
23
+ value: {
24
+ type: Array,
25
+ default: () => []
26
+ },
27
+ data: {
28
+ type: Array,
29
+ default: () => []
30
+ },
31
+ titles: {
32
+ type: Array,
33
+ default: () => ['列表 1', '列表 2']
34
+ },
35
+ leftDefaultChecked: {
36
+ type: Array,
37
+ default: () => []
38
+ },
39
+ rightDefaultChecked: {
40
+ type: Array,
41
+ default: () => []
42
+ },
43
+ props: {
44
+ type: Object,
45
+ default: () => {
46
+ return {
47
+ key: 'key',
48
+ label: 'label',
49
+ disabled: 'disabled'
50
+ }
51
+ }
52
+ },
53
+ targetOrder: {
54
+ type: String,
55
+ default: 'original'
56
+ },
57
+ filterable: {
58
+ type: Boolean,
59
+ default: false
60
+ },
61
+ filterPlaceholder: {
62
+ type: String,
63
+ default: '请输入搜索内容'
64
+ },
65
+ isDrag: {
66
+ type: Boolean,
67
+ default: true
68
+ }
69
+ },
70
+ watch: {
71
+ value: {
72
+ handler(val) {
73
+ this.rightData = val;
74
+ },
75
+ immediate: true
76
+ }
77
+ },
78
+ data() {
79
+ return {
80
+ rightData: []
81
+ };
82
+ },
83
+ mounted() {
84
+ this.$nextTick(() => {
85
+ if(!this.isDrag) return
86
+ this.initSortable();
87
+ })
88
+ },
89
+ methods: {
90
+ initSortable() {
91
+ const _this = this;
92
+ console.log(this.props)
93
+ const transferDoms = document.getElementsByClassName('el-transfer-panel__list');
94
+ if (transferDoms && transferDoms.length > 1) {
95
+ // 找到 transferDoms[1] 下所有类名为 el-checkbox__label 的元素
96
+ const checkboxLabels = transferDoms[1].querySelectorAll('.el-checkbox__label');
97
+ // 为每个元素添加类名 drag-item
98
+ checkboxLabels.forEach(label => {
99
+ label.classList.add('drag-item');
100
+ });
101
+
102
+ Sortable.create(transferDoms[1], {
103
+ handle: '.el-transfer-panel__item', // 触发拖动事件的元素
104
+ draggable: '.el-transfer-panel__item', // 拖动触发时,可拖动的区域
105
+ animation: 150,
106
+ sort: true,
107
+ disabled: false,
108
+ onEnd(event) {
109
+ const oldIndex = event.oldIndex;
110
+ const newIndex = event.newIndex;
111
+ // 更新 this.rightData 的顺序
112
+ const movedItem = _this.rightData.splice(oldIndex, 1)[0];
113
+ _this.rightData.splice(newIndex, 0, movedItem);
114
+ // 遍历 this.rightData,根据 props.key 和 props.sort 获取对应的值
115
+ const keyField = _this.props.key || 'key'; // 动态获取 key 字段
116
+ const sortField = _this.props.sort || 'fchSort'; // 动态获取 sort 字段
117
+
118
+ const list = _this.rightData.map((item, index) => {
119
+ return {
120
+ [keyField]: item, // 使用 props.key 的值作为键
121
+ [sortField]: index // 使用 props.sort 的值作为键
122
+ };
123
+ });
124
+ _this.$emit('drag', list,);
125
+ }
126
+ });
127
+ }
128
+ },
129
+ handelChange(leftArr, position, rightArr) {
130
+ this.$emit('change', leftArr, position, rightArr)
131
+ if(!this.isDrag) return
132
+ this.$nextTick(() => {
133
+ this.initSortable()
134
+ })
135
+
136
+ },
137
+ filterMethod() {
138
+ this.$emit('filter-method')
139
+ }
140
+ }
141
+ }
142
+ </script>
143
+ <style lang="less" scoped>
144
+ /deep/.drag-item {
145
+ cursor: move;
146
+ }
147
+ </style>
@@ -6,6 +6,7 @@
6
6
  Vue.directive('hasPermi', {
7
7
  inserted(el, binding, vnode) {
8
8
  const { value } = binding
9
+ console.log('value',value)
9
10
  const all_permission = "*:*:*";
10
11
  const permissions = localStorage.getItem('authorities').split(',')//用户拥有的权限
11
12
  if (value && value instanceof Array && value.length > 0) {
@@ -73,7 +73,6 @@ export default {
73
73
  align-items: center;
74
74
  user-select: none;
75
75
  cursor: pointer;
76
- padding: 5px;
77
76
  }
78
77
  .view-btn {
79
78
  &:hover {
@@ -1,7 +1,8 @@
1
1
  <template>
2
- <div class="default-text">
3
- <span class="default-text" :style="[statusStyle]"
2
+ <div>
3
+ <span class="default-text" :style="[statusStyle]" v-if="tableData.columnType == 'text'"
4
4
  :class="tableData.getClass ? tableData.getClass(scope.row) : ''">{{ getText(tableData.bind) }}</span>
5
+ <el-button v-if="tableData.columnType == 'button'" size="mini" plain round :type="tableData.setType(this.scope.row)">{{ getText(tableData.bind) }}</el-button>
5
6
  </div>
6
7
  </template>
7
8
  <script>
@@ -27,25 +28,45 @@ export default {
27
28
  }
28
29
  </script>
29
30
  <style lang="less" scoped>
30
- .deathText {
31
- color: #909399;
32
- }
33
-
34
- .normalText {
35
- color: #67c23a;
36
- }
37
31
 
38
- .danger {
39
- color: #f56c6c;
40
- }
41
-
42
- .warning {
43
- color: #e6a23c;
44
- }
45
32
 
46
33
  .default-text {
47
- overflow: hidden;
48
- text-overflow: ellipsis;
49
- white-space: nowrap;
34
+ font-size: 14px;
35
+ }
36
+ /deep/ .el-button {
37
+ cursor: text;
38
+ &.is-plain:focus, &.is-plain:hover {
39
+ background: #FFF;
40
+ border: 1px solid #DCDFE6;
41
+ color: #606266;
42
+ }
43
+ &--primary {
44
+ &.is-plain:focus, &.is-plain:hover {
45
+ color: #409EFF;
46
+ background: #ecf5ff;
47
+ border-color: #b3d8ff;
48
+ }
49
+ }
50
+ &--warning {
51
+ &.is-plain:focus, &.is-plain:hover {
52
+ color: #E6A23C;
53
+ background: #fdf6ec;
54
+ border-color: #f5dab1;
55
+ }
56
+ }
57
+ &--success {
58
+ &.is-plain:focus, &.is-plain:hover {
59
+ color: #67C23A;
60
+ background: #f0f9eb;
61
+ border-color: #c2e7b0;
62
+ }
63
+ }
64
+ &--danger {
65
+ &.is-plain:focus, &.is-plain:hover {
66
+ color: #F56C6C;
67
+ background: #fef0f0;
68
+ border-color: #fbc4c4;
69
+ }
70
+ }
50
71
  }
51
72
  </style>