tianheng-ui 0.0.32 → 0.0.35

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,7 +1,7 @@
1
1
  {
2
2
  "name": "tianheng-ui",
3
3
  "description": "A Vue.js project",
4
- "version": "0.0.32",
4
+ "version": "0.0.35",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -0,0 +1,8 @@
1
+ import Dialog from "./index.vue";
2
+
3
+ /* istanbul ignore next */
4
+ Dialog.install = function(Vue) {
5
+ Vue.component(Dialog.name, Dialog);
6
+ };
7
+
8
+ export default Dialog;
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <el-dialog
3
+ class="th-dialog"
4
+ :visible.sync="visible"
5
+ :fullscreen="dialogFullscreen"
6
+ :close-on-click-modal="false"
7
+ :show-close="false"
8
+ :before-close="handleClose"
9
+ >
10
+ <div slot="title" style="font-size: 14px;">
11
+ <div slot="title" class="th-dialog__header">
12
+ <div class="th-dialog__title">{{ title }}</div>
13
+ <div class="th-dialog__action">
14
+ <i
15
+ v-if="showFullscreen"
16
+ :class="fullscreenIcon"
17
+ @click="handleFullscreenChange"
18
+ ></i>
19
+ <i v-if="showClose" :class="closeIcon" @click="handleClose"></i>
20
+ </div>
21
+ </div>
22
+ </div>
23
+ <slot></slot>
24
+ <span slot="footer">
25
+ <el-button
26
+ v-if="showAffirm"
27
+ type="primary"
28
+ :loading="loading"
29
+ @click="handleAffirm"
30
+ >{{ affirmText }}</el-button
31
+ >
32
+ <el-button v-if="showCancel" @click="handleClose">{{
33
+ cancelText
34
+ }}</el-button>
35
+ </span>
36
+ </el-dialog>
37
+ </template>
38
+
39
+ <script>
40
+ export default {
41
+ name: "ThDialog",
42
+ props: {
43
+ visible: Boolean,
44
+ loading: Boolean,
45
+ title: { type: String, default: "温馨提示" },
46
+
47
+ showAffirm: { type: Boolean, default: true },
48
+ affirmText: { type: String, default: "确 认" },
49
+
50
+ showCancel: { type: Boolean, default: true },
51
+ cancelText: { type: String, default: "取 消" },
52
+
53
+ showClose: { type: Boolean, default: true },
54
+ closeIcon: { type: String, default: "el-icon-close" },
55
+
56
+ fullscreen: { type: Boolean, default: false },
57
+ showFullscreen: { type: Boolean, default: true },
58
+ fullscreenIcon: { type: String, default: "el-icon-full-screen" }
59
+ },
60
+ data() {
61
+ return {
62
+ formRules: {},
63
+ dialogFullscreen: this.fullscreen
64
+ };
65
+ },
66
+ watch: {
67
+ fullscreen(value) {
68
+ this.dialogFullscreen = value;
69
+ }
70
+ },
71
+ methods: {
72
+ handleClose() {
73
+ this.$emit("on-close");
74
+ },
75
+ handleAffirm() {
76
+ this.$emit("on-affirm");
77
+ },
78
+ handleFullscreenChange() {
79
+ this.dialogFullscreen = !this.dialogFullscreen;
80
+ this.$emit("fullscreen-change");
81
+ }
82
+ }
83
+ };
84
+ </script>
@@ -1,42 +1,23 @@
1
1
  <template>
2
2
  <div class="th-table-action" @click.stop>
3
3
  <template v-for="(item, index) in actions">
4
- <el-button
5
- v-if="item.act === 'edit'"
6
- :key="index"
7
- :style="item.style"
8
- :type="item.type"
9
- :icon="item.icon"
10
- :disabled="btnDisabled(item)"
11
- @click="doEdit(item)"
12
- >{{ item.name }}</el-button
13
- >
14
- <el-button
15
- v-else-if="item.act === 'look'"
16
- :key="index"
17
- :style="item.style"
18
- :type="item.type"
19
- :icon="item.icon"
20
- :disabled="btnDisabled(item)"
21
- @click="doLook(item)"
22
- >{{ item.name }}</el-button
23
- >
24
4
  <el-popover
25
- class="action-popover"
26
- v-else-if="item.act === 'delete'"
5
+ v-if="item.act === 'delete'"
27
6
  :key="index"
28
7
  v-model="pop"
29
8
  placement="top"
30
- title=""
31
9
  width="180"
32
10
  trigger="manual"
33
11
  >
34
12
  <p>{{ item.delmsg || msg }}</p>
35
13
  <div style="text-align: right; margin: 0">
36
- <el-button type="text" :disabled="loadingDel" @click="doCancel"
14
+ <el-button type="text" :disabled="loadingDel" @click="handleCancel"
37
15
  >取消</el-button
38
16
  >
39
- <el-button type="text" :loading="loadingDel" @click="doDelete(item)"
17
+ <el-button
18
+ type="text"
19
+ :loading="loadingDel"
20
+ @click="handleDelete(item)"
40
21
  >确定</el-button
41
22
  >
42
23
  </div>
@@ -51,14 +32,14 @@
51
32
  >
52
33
  </el-popover>
53
34
  <el-dropdown
54
- v-else-if="item.act === 'more'"
35
+ v-if="item.act === 'more'"
55
36
  :key="index"
56
37
  :trigger="item.trigger || 'click'"
57
38
  :placement="item.placement || 'bottom-end'"
58
39
  :disabled="btnDisabled(item)"
59
40
  @command="
60
41
  value => {
61
- doMore(value, index, item);
42
+ handleMore(value, index, item);
62
43
  }
63
44
  "
64
45
  >
@@ -88,7 +69,7 @@
88
69
  :type="item.type"
89
70
  :icon="item.icon"
90
71
  :disabled="btnDisabled(item)"
91
- @click="doEval(item)"
72
+ @click="handleClick(item)"
92
73
  >{{ item.name }}</el-button
93
74
  >
94
75
  </template>
@@ -136,34 +117,25 @@ export default {
136
117
  }
137
118
  },
138
119
  methods: {
139
- toDelete() {
140
- this.pop = true;
141
- },
142
- doCancel() {
120
+ handleCancel() {
121
+ this.loadingDel = false;
143
122
  this.pop = false;
144
123
  },
145
- doEval(item) {
146
- this.$emit("on-eval", item);
147
- },
148
- doEdit(item) {
149
- this.$emit("on-edit", item);
150
- },
151
- doLook(item) {
152
- this.$emit("on-look", item);
124
+ handleClick(item) {
125
+ this.$emit("on-click", item);
153
126
  },
154
- doDelete(item) {
127
+ handleDelete(item) {
155
128
  this.loadingDel = true;
156
129
  const callback = bool => {
157
- this.loadingDel = false;
158
- this.pop = !bool;
130
+ bool ? this.handleCancel() : (this.loadingDel = false);
159
131
  };
160
- this.$emit("on-delete", item, callback);
132
+ this.handleClick(item, callback);
161
133
  },
162
- doMore(value, index, item) {
134
+ handleMore(value, index, item) {
163
135
  for (let i = 0; i < item.children.length; i++) {
164
136
  const element = item.children[i];
165
137
  if (element.act === value) {
166
- this.$emit("on-more", element);
138
+ this.handleClick(element);
167
139
  break;
168
140
  }
169
141
  }
@@ -10,6 +10,7 @@
10
10
  :border="border"
11
11
  :highlight-current-row="selectType === 'single'"
12
12
  :tree-props="treeProps"
13
+ :span-method="objectSpanMethod"
13
14
  @current-change="handleSingleSelect"
14
15
  @row-dblclick="dblclick"
15
16
  @selection-change="handleSelectionChange"
@@ -291,6 +292,9 @@ export default {
291
292
  }
292
293
  );
293
294
  return time_str;
295
+ },
296
+ objectSpanMethod(data) {
297
+ this.$emit("span-method", data);
294
298
  }
295
299
  }
296
300
  };
@@ -300,6 +304,7 @@ export default {
300
304
  .th-table {
301
305
  position: relative;
302
306
  width: 100%;
307
+ height: 100%;
303
308
  .pagination {
304
309
  margin-top: 20px;
305
310
  }