@xilonglab/vue-main 0.8.17 → 0.9.1

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": "@xilonglab/vue-main",
3
- "version": "0.8.17",
3
+ "version": "0.9.1",
4
4
  "description": "xilong vue main",
5
5
  "main": "packages/index.js",
6
6
  "scripts": {
package/packages/index.js CHANGED
@@ -41,6 +41,7 @@ import XlReviewDialog from './dialog/XlReviewDialog.vue'
41
41
 
42
42
  // Main Components
43
43
  import XlDataView from './main/XlDataView.vue'
44
+ import XlDataTable from './main/XlDataTable.vue'
44
45
  import XlDataReview from './main/XlDataReview.vue'
45
46
  import XlDataFormDialog from './main/XlDataFormDialog.vue'
46
47
  import XlDataReviewDialog from './main/XlDataReviewDialog.vue'
@@ -93,6 +94,7 @@ const components = [
93
94
  XlReviewDialog,
94
95
  // Main Components
95
96
  XlDataView,
97
+ XlDataTable,
96
98
  XlDataReview,
97
99
  XlDataFormDialog,
98
100
  XlDataReviewDialog,
@@ -65,6 +65,22 @@ defineExpose({
65
65
  <xl-dialog class="xl-data-form-dialog" :ref="refs.dialog" :title="chinese" :width="width" :validate="validate"
66
66
  :callback="callback" @finish="emits('finish')">
67
67
  <el-form :ref="refs.form" :model="obj" :rules="rules" :label-width="`${labelWidth}px`">
68
+ <el-row>
69
+ <template v-for="col in columns" :key="col.prop">
70
+ <xl-form-col
71
+ v-if="col.form"
72
+ :span="col.form.span"
73
+ :l="col.label"
74
+ :p="col.prop"
75
+ >
76
+ <component
77
+ :is="`xl-${col.form.type || 'input'}`"
78
+ v-model="obj.value[col.prop]"
79
+ v-bind="col.form || {}"
80
+ />
81
+ </xl-form-col>
82
+ </template>
83
+ </el-row>
68
84
  <slot />
69
85
  </el-form>
70
86
  </xl-dialog>
@@ -0,0 +1,138 @@
1
+ <script setup>
2
+ defineOptions({ name: "XlDataTable" })
3
+
4
+ import { inject, computed } from 'vue'
5
+
6
+ const props = defineProps({
7
+ selectable: {
8
+ type: Boolean,
9
+ default: false,
10
+ },
11
+ columns: {
12
+ type: Array,
13
+ default: () => [],
14
+ },
15
+ showSummary: {
16
+ type: Boolean,
17
+ default: true,
18
+ },
19
+ rowClick: {
20
+ type: Function,
21
+ default: () => { },
22
+ },
23
+ summaryMethod: {
24
+ type: Function,
25
+ },
26
+ showIndex: {
27
+ type: Boolean,
28
+ default: false,
29
+ },
30
+ disableAdd: {
31
+ type: Boolean,
32
+ default: false,
33
+ },
34
+ pagination: {
35
+ type: Object,
36
+ default() {
37
+ return {
38
+ pageNum: 1,
39
+ pageSize: 20,
40
+ total: 0,
41
+ };
42
+ },
43
+ },
44
+ spanMethod: {
45
+ type: Function,
46
+ default: () => { },
47
+ },
48
+ headerCellStyle: {
49
+ type: Function,
50
+ default: () => { },
51
+ },
52
+ rowClassName: {
53
+ type: Function,
54
+ default: () => { },
55
+ },
56
+ rowKey: {
57
+ type: Function,
58
+ default: () => { },
59
+ },
60
+ rowDblClick: {
61
+ type: Function,
62
+ default: () => { },
63
+ },
64
+ selectionChange: {
65
+ type: Function,
66
+ default: () => { },
67
+ },
68
+ layout: {
69
+ type: String,
70
+ default: 'prev, pager, next, jumper'
71
+ }
72
+ });
73
+
74
+ const { refs, api, params, obj, total } = inject('injections')
75
+ </script>
76
+
77
+
78
+ <template>
79
+ <xl-query-page-table v-show="params.view != 'chart'" :ref="refs.table" :api="api" :params="params"
80
+ v-bind="$props" :summary-method="summaryMethod?summaryMethod:()=>({0:total})" :sort-change="(data) => api.sort(data)">
81
+ <template v-for="col in columns" :key="col.prop">
82
+ <template v-if="!col.hidden">
83
+ <xl-datetime-col
84
+ v-if="col.type === 'datetime'"
85
+ :l="col.label"
86
+ :p="col.prop"
87
+ />
88
+ <xl-map-col
89
+ v-else-if="col.type === 'map'"
90
+ :l="col.label"
91
+ :p="col.prop"
92
+ :width="col.width"
93
+ :map="col.map"
94
+ />
95
+ <xl-status-col
96
+ v-else-if="col.type === 'status'"
97
+ :l="col.label"
98
+ :p="col.prop"
99
+ :map="col.map"
100
+ />
101
+ <xl-review-col
102
+ v-else-if="col.type === 'review'"
103
+ :l="col.label"
104
+ :p="col.prop"
105
+ />
106
+ <xl-clamp-col
107
+ v-else-if="col.type === 'clamp'"
108
+ :l="col.label"
109
+ :p="col.prop"
110
+ :width="col.width"
111
+ />
112
+ <xl-bool-col
113
+ v-else-if="col.type === 'bool'"
114
+ :l="col.label"
115
+ :p="col.prop"
116
+ :width="col.width"
117
+ />
118
+ <xl-col
119
+ v-else
120
+ :l="col.label"
121
+ :p="col.prop"
122
+ :width="col.width"
123
+ />
124
+ </template>
125
+ </template>
126
+ <slot name="columns" />
127
+ </xl-query-page-table>
128
+ </template>
129
+
130
+
131
+ <style lang="less">
132
+ .xl-data-table {
133
+ div.cell {
134
+ padding: 0 !important;
135
+
136
+ }
137
+ }
138
+ </style>