gyyg-components 0.2.5 → 0.2.6

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.5",
3
+ "version": "0.2.6",
4
4
  "private": false,
5
5
  "main": "lib/gyyg-components.umd.js",
6
6
  "scripts": {
package/src/App.vue CHANGED
@@ -1,208 +1,75 @@
1
1
  <template>
2
- <div id="app" :key="key">
2
+ <div id="app">
3
3
  <mec-input-table
4
- :tableData="tableData"
5
- :columns="columns"
6
- :inputInfo="inputInfo"
7
- @search="searchHandel"
8
- @refresh="refreshHandel"
9
- @show="showHandel"
10
- :showSearch="false"
11
- @row-click="rowClick"
4
+ :tableData="tableData"
5
+ :columns="columns"
6
+ :height="height"
7
+ :page="page"
8
+ :inputInfo="inputInfo"
9
+ :showSearch="showSearch"
10
+ @row-click="handleRowClick"
11
+ @page-size-change="handlePageSizeChange"
12
+ @page-change="handlePageChange"
13
+ @show="show"
12
14
  ></mec-input-table>
13
- <mec-button-group :btnList="btnList"></mec-button-group>
14
- <el-form ref="form" :model="formData" :rules="rules" label-width="100px">
15
- <el-form-item label="数字输入框" prop="numberInput">
16
- <mec-input placeholder="请输入数字" inputType="number" type="number" v-model="formData.numberInput"></mec-input>
17
- </el-form-item>
18
- <el-form-item label="汉字输入框" prop="chineseInput">
19
- <mec-input placeholder="请输入汉字" inputType="chinese" type="text" v-model="formData.chineseInput"></mec-input>
20
- </el-form-item>
21
- <el-form-item label="英文输入框" prop="englishInput">
22
- <mec-input placeholder="请输入英文" inputType="english" clearable type="text" v-model="formData.englishInput"></mec-input>
23
- </el-form-item>
24
- <el-form-item label="自定义正则输入框" prop="regexInput">
25
- <mec-input placeholder="请按正则输入" inputType="regex" type="text" :maxlength="11" v-model="formData.regexInput">
26
- </mec-input>
27
- </el-form-item>
28
- <el-form-item label="正常输入框" prop="input">
29
- <mec-input placeholder="输入" type="text" :clearable="true" v-model="formData.input" @clear="clear">
30
- </mec-input>
31
- </el-form-item>
32
- <el-form-item label="文本域" prop="input">
33
- <mec-input placeholder="输入" type="textarea" v-model="formData.textarea" :autosize="{minRows: 2, maxRows: 4}" :rows="2">
34
- </mec-input>
35
- </el-form-item>
36
- <el-button @click="submitForm">提交</el-button>
37
- </el-form>
38
- <mec-table
39
- :tableData="tableData"
40
- :columns="columns"
41
- :selection="true"
42
- @selection-change="selectionChange"
43
-
44
- :highlightSelectionRow="true"
45
- ></mec-table>
46
15
  </div>
16
+
47
17
  </template>
48
18
 
49
19
  <script>
50
20
 
51
21
  export default {
52
- name: 'App',
53
22
  data() {
54
- const _this = this;
55
23
  return {
56
- btnList: [
57
- // 按钮列表配置
58
- {
59
- text: '转资审租',
60
- componentType: 'mec-popover-button',
61
- size: 'medium',
62
- type: 'primary',
63
- disabled: false,
64
- id: 'popover',
65
- options: [
66
- {
67
- label: '转谈判组',
68
- value: '1',
69
- },
70
- {
71
- label: '转呈批组',
72
- value: '1',
73
- },
74
- {
75
- label: '转签约组',
76
- value: '1',
77
- },
78
- ],
79
- trigger() {
80
- console.log('按钮点击');
81
- },
82
- callback(row) {
83
- console.log(row);
84
-
85
- }
86
- }
87
- ],
88
- formData: {
89
- numberInput: '',
90
- chineseInput: '',
91
- regexInput: '',
92
- englishInput: '',
93
- input: '',
94
- textarea: ''
24
+ inputInfo: {
25
+ inputPlaceholder: '请输入',
26
+ clearable: true,
27
+ disabled: false,
28
+ tablePlaceholder: '请输入'
95
29
  },
96
- rules: {
97
- numberInput: [
98
- { required: true, message: '数字输入框不能为空', trigger: 'blur' },
99
- ],
100
- chineseInput: [
101
- { required: true, message: '汉字输入框不能为空', trigger: 'blur' },
102
- ],
103
- englishInput: [
104
- { required: true, message: '英文输入框不能为空', trigger: 'blur' },
105
- ],
106
- regexInput: [
107
- { required: true, message: '自定义正则输入框不能为空', trigger: 'blur' },
108
- { validator: this.validateRegex, message: '请按正则输入内容', trigger: 'blur' }
109
- ]
30
+ showSearch: true,
31
+ showSelection: true,
32
+ height: '200',
33
+ page: {
34
+ currentPage: 1,
35
+ total: 100,
36
+ pageSize: 20,
110
37
  },
111
- regexInfo: /^(?:(?:\+|00)86)?1[3-9]\d{9}$/,
112
- tableData: [],
38
+ tableData: [
39
+ { name: '数据1', value: 'value1' },
40
+ { name: '数据2', value: 'value2' },
41
+ { name: '数据3', value: 'value3' },
42
+ ],
113
43
  columns: [
114
44
  {
115
- label: '编码',
116
- bind: 'sdDeptCode'
45
+ bind: 'name',
46
+ label: '姓名'
117
47
  },
118
48
  {
119
- label: '名称',
120
- bind: 'sdDeptName',
121
- },
122
- {
123
- label: '负责人',
124
- bind: 'sdPrincipal'
125
- },
126
- {
127
- label: '院区',
128
- bind: 'sdOrgName',
129
- width: '150'
49
+ label: '编码',
50
+ bind: 'value'
130
51
  }
131
- ],
132
- inputInfo: {
133
- inputPlaceholder: '科室',
134
- tablePlaceholder: '编码/名称',
135
- inputValue: ''
136
- },
137
- key: 0
52
+ ]
138
53
  };
139
54
  },
140
55
  methods: {
141
- change(val) {
142
- console.log(val);
143
- },
144
- validateRegex(rule, value, callback) {
145
- const reg = this.regexInfo;
146
- if (reg.test(value)) {
147
- callback();
148
- } else {
149
- callback(new Error('请按正则输入内容'));
150
- }
151
- },
152
- submitForm() {
153
- this.$refs.form.validate((valid) => {
154
- if (valid) {
155
- console.log('表单验证通过');
156
- } else {
157
- console.log('表单验证失败');
158
- }
159
- });
160
- },
161
- updateArrayById(arr, updateConfigs) {
162
- const newArray = arr.map(item => ({ ...item }));
163
- updateConfigs.forEach(config => {
164
- const index = newArray.findIndex(el => el.id === config.id);
165
- if (index !== -1) {
166
- for (const key in config) {
167
- if (key !== 'id') {
168
- newArray[index][key] = config[key];
169
- }
170
- }
171
- }
172
- });
173
- return newArray;
56
+ handleRowClick(row) {
57
+ console.log('Row clicked:', row);
174
58
  },
175
- clear() {
176
- console.log('清除操作');
177
- this.key++
59
+ handlePageSizeChange(val) {
60
+ console.log('Page size changed:', val);
61
+ // 在这里处理 page-size-change 事件
178
62
  },
179
- searchHandel(val) {
180
- console.log(val);
63
+ handlePageChange(val) {
64
+ console.log('Page changed:', val);
181
65
  },
182
- refreshHandel() {
183
- console.log('重置')
66
+ handleCurrentChange(val) {
67
+ console.log('Current change:', val);
184
68
  },
185
- rowClick(row) {
186
- console.log(row);
187
- this.inputInfo.inputValue = row.sdDeptName // 赋值操作
188
- },
189
- selectionChange(val) {
190
- console.log(val, 123);
191
- },
192
- showHandel() {
193
- this.tableData = [
194
- {
195
- id: "99a4bdb4513e17ad1c2a2436a735a86f",
196
- sdDeptCode: "1232131",
197
- sdDeptName: "a1111",
198
- sdOrgId: "069fcbfce1d4e0233546bc5dba114a75",
199
- sdOrgName: "国药医工第一院区",
200
- sdPrincipal: "张三"
201
- }
202
- ]
69
+ show() {
70
+ console.log('显示');
203
71
 
204
72
  }
205
-
206
73
  }
207
74
  };
208
75
  </script>
@@ -1,32 +1,48 @@
1
1
  <template>
2
2
  <div>
3
- <el-dropdown trigger="click" @visible-change="visibleChange">
4
- <el-input
5
- :placeholder="inputInfo.inputPlaceholder"
6
- v-model="inputValue"
7
- class="el-dropdown-link"
8
- readonly
9
- :suffix-icon="showDropdown ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></el-input>
10
- <el-dropdown-menu slot="dropdown" class="mec-input-table">
11
- <div class="search-table" v-if="showSearch">
12
- <el-input
13
- :placeholder="inputInfo.tablePlaceholder"
14
- v-model="tableInput"
15
- @input="tableInputHandel"
16
- ></el-input>
17
- <el-button type="primary" size="medium" @click="search">查询</el-button>
18
- <el-button icon="el-icon-refresh" size="medium" @click="refresh"></el-button>
19
- </div>
20
-
21
- <el-dropdown-item>
22
- <mec-table
23
- :tableData="tableData"
24
- style="width: 100%"
25
- @row-click="handleTableRowClick"
26
- :columns="columns">
27
- </mec-table>
28
- </el-dropdown-item>
29
- </el-dropdown-menu>
3
+ <el-dropdown trigger="click" ref="dropdown" @visible-change="visibleChange">
4
+ <el-input v-model="inputValue" :placeholder="inputInfo.inputPlaceholder" readonly>
5
+ <template slot="suffix">
6
+ <i class="el-input__icon el-icon-arrow-down"></i>
7
+ </template>
8
+ </el-input>
9
+ <el-dropdown-menu slot="dropdown">
10
+ <div class="search-table" v-if="showSearch">
11
+ <el-input
12
+ :placeholder="inputInfo.tablePlaceholder"
13
+ v-model="tableInput"
14
+ ></el-input>
15
+ <el-button type="primary" size="medium" @click="search">查询</el-button>
16
+ <el-button icon="el-icon-refresh" size="medium" @click="refresh"></el-button>
17
+ </div>
18
+ <el-table :data="tableData" style="width: 100%" @row-click="rowClick">
19
+ <!-- <el-table-column
20
+ type="selection"
21
+ :reserve-selection="true"
22
+ width="55"
23
+ v-if="showSelection"
24
+ ></el-table-column> -->
25
+ <el-table-column
26
+ v-for="(item, index) in columns"
27
+ :key="index"
28
+ :prop="item.bind"
29
+ :label="item.label"
30
+ :show-overflow-tooltip="true"
31
+ :width="item.width"
32
+ >
33
+ </el-table-column>
34
+
35
+ </el-table>
36
+ <el-pagination
37
+ @size-change="handleSizeChange"
38
+ @current-change="handleCurrentChange"
39
+ :current-page="page.currentPage"
40
+ :page-sizes="[10, 20, 30, 50]"
41
+ :page-size="page.pageSize"
42
+ layout="total, sizes, prev, pager, next"
43
+ :total="page.total">
44
+ </el-pagination>
45
+ </el-dropdown-menu>
30
46
  </el-dropdown>
31
47
  </div>
32
48
  </template>
@@ -43,12 +59,23 @@ export default {
43
59
  type: Array,
44
60
  default: () => []
45
61
  },
62
+ showSelection: {
63
+ type: Boolean,
64
+ default: false
65
+ },
46
66
  inputInfo: {
47
67
  default: {}
48
68
  },
49
69
  showSearch:{
50
70
  type: Boolean,
51
71
  dafault: true
72
+ },
73
+ page: {
74
+ default: {}
75
+ },
76
+ toggleRow: {
77
+ type: Boolean,
78
+ default: true
52
79
  }
53
80
  },
54
81
  data() {
@@ -59,9 +86,11 @@ export default {
59
86
  };
60
87
  },
61
88
  methods: {
62
- handleTableRowClick(row) {
89
+ rowClick(row) {
90
+ if(this.toggleRow) {
91
+ this.$refs.dropdown.hide()
92
+ }
63
93
  this.$emit('row-click', row)
64
- this.showDropdown = false;
65
94
  },
66
95
  visibleChange(val) {
67
96
  this.showDropdown = val
@@ -79,6 +108,13 @@ export default {
79
108
  refresh() {
80
109
  this.tableInput = ''
81
110
  this.$emit('refresh')
111
+ },
112
+ handleSizeChange(val) {
113
+ this.$refs.dropdown.show()
114
+ this.$emit('size-change', val)
115
+ },
116
+ handleCurrentChange(val) {
117
+ this.$emit('current-change', val)
82
118
  }
83
119
 
84
120
  },
@@ -111,4 +147,7 @@ export default {
111
147
  margin-left: 15px;
112
148
  }
113
149
  }
150
+ /deep/ .el-pagination {
151
+ margin-top: 15px;
152
+ }
114
153
  </style>