tianheng-ui 0.1.36 → 0.1.37

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.1.36",
4
+ "version": "0.1.37",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -13,7 +13,7 @@
13
13
  <el-form-item prop="fieldsType" required>
14
14
  <el-tooltip
15
15
  slot="label"
16
- effect="dark"
16
+ effect="light"
17
17
  content="字段的配置方式"
18
18
  placement="top"
19
19
  >
@@ -31,7 +31,7 @@
31
31
  >
32
32
  <el-tooltip
33
33
  slot="label"
34
- effect="dark"
34
+ effect="light"
35
35
  content="使用接口的出参配置可选字段"
36
36
  placement="top"
37
37
  >
@@ -83,7 +83,7 @@
83
83
  <el-form-item>
84
84
  <el-tooltip
85
85
  slot="label"
86
- effect="dark"
86
+ effect="light"
87
87
  content="一般用于编辑和详情的数据回显"
88
88
  placement="top"
89
89
  >
@@ -13,7 +13,7 @@
13
13
  <el-form-item>
14
14
  <el-tooltip
15
15
  slot="label"
16
- effect="dark"
16
+ effect="light"
17
17
  content="切换组件会导致该组件配置信息重置,请谨慎使用!"
18
18
  placement="top"
19
19
  >
@@ -37,7 +37,7 @@
37
37
  <el-form-item required v-if="config.fieldsType === 'fieldsApi'">
38
38
  <el-tooltip
39
39
  slot="label"
40
- effect="dark"
40
+ effect="light"
41
41
  content="组件关联数据表中的唯一字段"
42
42
  placement="top"
43
43
  >
@@ -60,7 +60,7 @@
60
60
  <el-form-item>
61
61
  <el-tooltip
62
62
  slot="label"
63
- effect="dark"
63
+ effect="light"
64
64
  content="表单提交时的入参名,对应数据表中的字段,非必要不修改!"
65
65
  placement="top"
66
66
  >
@@ -418,7 +418,7 @@ export default {
418
418
  }
419
419
  if (
420
420
  this.formConfig.config.fieldsType === "fieldsApi" &&
421
- !this.formConfig.config.fieldsApi
421
+ !this.formConfig.config.fieldsApi
422
422
  ) {
423
423
  this.$message.warning("请选择字段接口");
424
424
  return reject();
@@ -6,10 +6,8 @@ export const search = {
6
6
 
7
7
  // 列表配置
8
8
  export const table = {
9
- mounted: {
10
- api: ""
11
- },
12
9
  fieldsType: "fieldsApi",
10
+ mounted: { api: "" },
13
11
  options: [],
14
12
  pageInfo: {
15
13
  show: true,
@@ -18,7 +16,15 @@ export const table = {
18
16
  pageSize: 20,
19
17
  currentPage: 1,
20
18
  total: 0,
21
- sizes: [10, 20, 30, 50, 100]
19
+ sizes: [10, 20, 50, 100],
20
+ layout: "total,sizes,prev,pager,next,jumper"
21
+ },
22
+ style: {
23
+ small: false,
24
+ background: false,
25
+ disabled: false,
26
+ hideOnSinglePage: false,
27
+ align: "right"
22
28
  }
23
29
  },
24
30
  sort: {
@@ -40,6 +46,8 @@ export const table = {
40
46
  table: {
41
47
  border: true,
42
48
  height: "",
49
+ maxHeight: "",
50
+ customStyle: ""
43
51
  },
44
52
  cell: {
45
53
  customStyle: "",
@@ -63,7 +71,8 @@ export const table = {
63
71
  "text-align": "",
64
72
  color: "#333"
65
73
  }
66
- }
74
+ },
75
+ title: ""
67
76
  };
68
77
 
69
78
  // 按钮配置
@@ -0,0 +1,118 @@
1
+ <template>
2
+ <div class="generateTable-action" @click.stop>
3
+ <template v-for="(item, index) in options">
4
+ <el-popover
5
+ v-if="item.type === 'delete'"
6
+ v-model="pop"
7
+ :key="index"
8
+ placement="top"
9
+ width="180"
10
+ trigger="manual"
11
+ >
12
+ <p>{{ item.delmsg || msg }}</p>
13
+ <div style="text-align: right; margin: 0">
14
+ <el-button type="text" :disabled="loadingDel" @click="handleCancel"
15
+ >取消</el-button
16
+ >
17
+ <el-button
18
+ type="text"
19
+ :loading="loadingDel"
20
+ @click="handleDelete(item)"
21
+ >确定</el-button
22
+ >
23
+ </div>
24
+ <el-button
25
+ slot="reference"
26
+ :style="item.style.customStyle"
27
+ :type="item.style.type"
28
+ :icon="item.style.icon"
29
+ :plain="item.style.plain"
30
+ :round="item.style.round"
31
+ :circle="item.style.circle"
32
+ :size="item.style.size"
33
+ :disabled="item.style.disabled || loadingDel"
34
+ :loading="item.style.loading"
35
+ @click="pop = true"
36
+ >{{ item.name }}</el-button
37
+ >
38
+ </el-popover>
39
+ <el-button
40
+ v-else
41
+ :key="index"
42
+ :style="item.style.customStyle"
43
+ :type="item.style.type"
44
+ :icon="item.style.icon"
45
+ :plain="item.style.plain"
46
+ :round="item.style.round"
47
+ :circle="item.style.circle"
48
+ :size="item.style.size"
49
+ :disabled="item.style.disabled"
50
+ :loading="item.style.loading"
51
+ @click="handleClick(item)"
52
+ >{{ item.name }}</el-button
53
+ >
54
+ </template>
55
+ </div>
56
+ </template>
57
+
58
+ <script>
59
+ export default {
60
+ name: "ThTableAction",
61
+ props: {
62
+ options: Array,
63
+ scope: Object | String,
64
+ permission: {
65
+ type: Object,
66
+ required: false
67
+ },
68
+ msg: {
69
+ type: String,
70
+ default: "确定删除本条数据吗?"
71
+ }
72
+ },
73
+ data() {
74
+ return {
75
+ pop: false,
76
+ loadingDel: false
77
+ };
78
+ },
79
+ methods: {
80
+ handleCancel() {
81
+ this.loadingDel = false;
82
+ this.pop = false;
83
+ },
84
+ handleClick(item, callback) {
85
+ this.$emit("click", item, this.scope.row, callback);
86
+ },
87
+ handleDelete(item) {
88
+ this.loadingDel = true;
89
+ const callback = bool => {
90
+ bool ? this.handleCancel() : (this.loadingDel = false);
91
+ };
92
+ this.handleClick(item, callback);
93
+ },
94
+ handleMore(value, index, item) {
95
+ for (let i = 0; i < item.children.length; i++) {
96
+ const element = item.children[i];
97
+ if (element.type === value) {
98
+ this.handleClick(element);
99
+ break;
100
+ }
101
+ }
102
+ }
103
+ }
104
+ };
105
+ </script>
106
+
107
+ <style lang="scss" scoped>
108
+ .generateTable-action {
109
+ width: 100%;
110
+ display: flex;
111
+ align-items: center;
112
+ justify-content: space-around;
113
+
114
+ .el-button + .el-button {
115
+ margin-left: 0px;
116
+ }
117
+ }
118
+ </style>
@@ -4,16 +4,38 @@
4
4
  :style="config.style.table.customStyle"
5
5
  :data="data"
6
6
  :border="config.style.table.border"
7
- :height="config.style.table.height"
7
+ :height="config.style.table.height || null"
8
+ :empty-text="config.empty.text"
9
+ v-loading="config.loading.show"
10
+ :element-loading-text="config.loading.text"
8
11
  >
9
- <el-table-column
10
- v-for="item in config.options"
11
- :key="item.prop"
12
- :prop="item.prop"
13
- :label="item.label"
14
- :width="item.width || 180"
15
- >
16
- </el-table-column>
12
+ <template v-for="item in config.options">
13
+ <el-table-column
14
+ v-if="item.type"
15
+ :key="item.prop"
16
+ :type="item.type"
17
+ :label="item.label"
18
+ :width="item.width || 50"
19
+ >
20
+ </el-table-column>
21
+ <el-table-column
22
+ v-else
23
+ :key="item.prop"
24
+ :prop="item.prop"
25
+ :label="item.label"
26
+ :width="item.width || 180"
27
+ >
28
+ <template slot-scope="scope">
29
+ <slot
30
+ v-if="item.slot"
31
+ :name="item.slot"
32
+ :scope="scope"
33
+ :option="item"
34
+ />
35
+ <span v-else>{{ scope.row[item.prop] }}</span>
36
+ </template>
37
+ </el-table-column>
38
+ </template>
17
39
  </el-table>
18
40
  </div>
19
41
  </template>
@@ -22,15 +44,18 @@
22
44
  export default {
23
45
  props: {
24
46
  data: Array,
25
- config: Object
47
+ config: {
48
+ type: Object,
49
+ default: () => {
50
+ return { style: {} };
51
+ }
52
+ }
26
53
  },
27
54
  data() {
28
55
  return {};
29
56
  },
30
57
  created() {},
31
- mounted() {
32
- console.log(this.config)
33
- },
58
+ mounted() {},
34
59
  methods: {}
35
60
  };
36
61
  </script>