w-ui-v1 1.1.19 → 1.1.21

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.
@@ -270,6 +270,7 @@ function goto(type = '', PItem: any, item: any) {
270
270
  }
271
271
 
272
272
  .value {
273
+ font-weight: 600;
273
274
  //文字换行
274
275
  white-space: normal;
275
276
  word-break: break-all;
@@ -277,6 +278,7 @@ function goto(type = '', PItem: any, item: any) {
277
278
  }
278
279
 
279
280
  .link {
281
+ // font-weight: 600;
280
282
  color: #4d80f0;
281
283
  }
282
284
  }
@@ -60,6 +60,12 @@
60
60
  :placeholder="subItem.disabled ? '无需输入' : `请选择${subItem.title}`"
61
61
  :rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" @confirm="(e) => { change(e) }"
62
62
  @clear="clear" />
63
+
64
+ <wd-calendar v-else-if="subItem.extControlType === 'daterange'" :disabled="subItem.disabled" :label="subItem.title"
65
+ label-width="100px" :display-format="displayFormat2" :prop="subItem.id" clearable :modelValue="modelValue" type="daterange"
66
+ :placeholder="subItem.disabled ? '无需输入' : `请选择${subItem.title}`"
67
+ :rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" @confirm="(e) => { change(e) }"
68
+ @clear="clear" />
63
69
 
64
70
  <wd-cell v-else-if="(subItem.controlType === 'textarea'&&subItem.extControlType==='relselectvalue')||subItem.extControlType === 'entity-select'" title-width="100px" :prop="subItem.id"
65
71
  :rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" :title="subItem.title">
@@ -204,6 +210,17 @@ const modelValue = computed(() => {
204
210
  }):[]
205
211
  }
206
212
 
213
+ if(props.subItem.extControlType === 'datetime'){
214
+ return props.model[props.subItem.id]?dayjs(props.model[props.subItem.id]).valueOf():null
215
+ }
216
+
217
+ if(props.subItem.extControlType==='daterange'){
218
+
219
+ return props.model[props.subItem.id]?props.model[props.subItem.id].split("~").map((item:any)=>{
220
+ return dayjs(item).valueOf()
221
+ }):[]
222
+ }
223
+
207
224
  if(props.subItem.extControlType === 'relselect'){
208
225
  if(props.model[props.subItem.id]){
209
226
  let dataArr1=props.model[props.subItem.id].split('@,@')
@@ -221,9 +238,7 @@ const modelValue = computed(() => {
221
238
  return props.model[props.subItem.id]?[JSON.parse(props.model[props.subItem.id])['base']]:[]
222
239
  }
223
240
 
224
- if(props.subItem.extControlType === 'datetime'){
225
- return props.model[props.subItem.id]?dayjs(props.model[props.subItem.id]).valueOf():null
226
- }
241
+
227
242
 
228
243
 
229
244
  return props.model[props.subItem.id] || null
@@ -291,6 +306,15 @@ const change = (e:any) => {
291
306
  return
292
307
  }
293
308
 
309
+ if(props.subItem.extControlType==='daterange'){
310
+
311
+ let data=e.value.map((item:any)=>{
312
+ return dayjs(item).format('YYYY-MM-DD')
313
+ })
314
+ emit('update:modelValue', data.join('~'))
315
+ return
316
+ }
317
+
294
318
  if(props.subItem.controlType==='datetime'||props.subItem.extControlType==='datetime'){
295
319
 
296
320
  let data=dayjs(e.value).format('YYYY-MM-DD HH:mm:ss')
@@ -298,6 +322,7 @@ const change = (e:any) => {
298
322
  return
299
323
  }
300
324
 
325
+
301
326
  emit('update:modelValue', e.value)
302
327
 
303
328
  // switch (props.subItem.controlType) {
@@ -317,4 +342,8 @@ const clear = () => {
317
342
  }
318
343
  </script>
319
344
 
320
- <style scoped></style>
345
+ <style scoped>
346
+ :deep(.wd-cell__wrapper){
347
+ align-items: center !important;
348
+ }
349
+ </style>
package/w-menu/w-menu.vue CHANGED
@@ -66,17 +66,18 @@ console.log(item.pageType)
66
66
  }
67
67
 
68
68
  return true
69
- break;
69
+
70
70
  case "报表":
71
71
  uni.navigateTo({
72
72
  url: `/pages/report-table/report-table?sourceId=${item.id}&pageTitle=${item.title}`,
73
73
  })
74
74
  return true
75
- break;
75
+
76
76
 
77
77
  default:
78
+
78
79
  return false
79
- break;
80
+
80
81
  }
81
82
  }
82
83
 
@@ -1,10 +1,13 @@
1
1
  <template>
2
2
  <view class="smart-table-container">
3
+ <!-- 搜索 -->
4
+ <wSearch :primaryCriteria="pageConfigs.primaryCriteria" :criterias="pageConfigs.drillingParams" @search="search" v-if="pageConfigs.buttons?.includes('query')">
5
+ </wSearch>
3
6
  <!-- 横向滚动容器 -->
4
7
  <scroll-view scroll-x class="table-scroll-x">
5
8
  <!-- 表格头部 -->
6
9
  <view class="table-header">
7
- <view class="header-cell" v-for="(col, index) in columns" :key="index"
10
+ <view class="header-cell" v-for="(col, index) in ccolumns" :key="index"
8
11
  :style="{ width: col.width || '200px' }">
9
12
  <view @click="sortColumn(col)" style="display: flex; align-items: center;">
10
13
  {{ col.title }}
@@ -18,19 +21,21 @@
18
21
  </view>
19
22
 
20
23
  <!-- 表格内容 -->
21
- <scroll-view scroll-y class="table-body" :style="{height: bodyHeight + 'px'}">
22
- <view class="table-row" v-for="(row, rowIndex) in data" :key="rowIndex"
24
+ <scroll-view scroll-y class="table-body" :style="{maxHeight: bodyHeight + 'rpx'}">
25
+ <view class="table-row" :style="{backgroundColor:(row.dataType==='小计'?'#B9E0FF':row.dataType==='合计'?'#69B0FE':null),fontWeight:row.dataType==='小计'||row.dataType==='合计'?'700':null }" v-for="(row, rowIndex) in cdata" :key="rowIndex"
23
26
  :class="{ 'zebra-stripe': rowIndex % 2 === 0 }">
24
- <view class="body-cell" v-for="(col, colIndex) in columns" :key="colIndex"
25
- :style="{ width: col.width || 'auto' }">
26
- {{ row[col.key] }}
27
+ <view class="body-cell" v-for="(col, colIndex) in ccolumns" :key="colIndex"
28
+ :style="{ width: col.width || 'auto'}">
29
+
30
+ <text v-if="(row[col.key]==='小计'||row[col.key]==='合计')&&(colIndex>0)"></text>
31
+ <text v-else>{{ row[col.key] }}</text>
27
32
  </view>
28
33
  </view>
29
34
  </scroll-view>
30
35
 
31
36
  <!-- 合计行 -->
32
37
  <view class="summary-row" v-if="showSummary">
33
- <view class="summary-cell" v-for="col in columns" :key="col.key"
38
+ <view class="summary-cell" v-for="col in ccolumns" :key="col.key"
34
39
  :style="{ width: col.width || 'auto' }">
35
40
  <text v-if="col.summary">{{ getSummary(col) }}</text>
36
41
  <text v-else-if="col.key === columns[0].key">合计</text>
@@ -40,7 +45,7 @@
40
45
  </scroll-view>
41
46
 
42
47
  <!-- 分页控件 -->
43
- <view class="pagination">
48
+ <view class="pagination" v-if="pagination">
44
49
  <view class="page-btn" :class="{ disabled: currentPage === 1 }" @click="prevPage">
45
50
  上一页
46
51
  </view>
@@ -54,127 +59,180 @@
54
59
  </view>
55
60
  </template>
56
61
 
57
- <script>
58
- import {
59
- getPageData,
60
- getPageKey,
61
- pageConfig,
62
- getEnum
63
- } from '../utils/apis/pageConfig'
64
- export default {
65
- name: 'WReportTable',
66
- props: {
67
- sourceId: {
68
- type: String,
69
- default: ''
70
- },
71
- mainCode: {
72
- type: String,
73
- default: ''
74
- },
75
- showSummary: {
76
- type: Boolean,
77
- default: false
78
- },
79
- sortable: {
80
- type: Boolean,
81
- default: false
82
- },
83
- columns: {
84
- type: Array,
85
- required: true
86
- },
87
- data: {
88
- type: Array,
89
- required: true
90
- },
91
- pageSize: {
92
- type: Number,
93
- default: 10
94
- },
95
- total: {
96
- type: Number,
97
- required: false,
98
- default: 0
99
- },
100
- loading: {
101
- type: Boolean,
102
- default: false
103
- }
104
- },
105
- data() {
106
- return {
107
- currentPage: 1,
108
- bodyHeight: 300,
109
- sortField: '',
110
- sortOrder: 'asc',
111
- pageData:{}
112
- }
113
- },
114
- computed: {
115
- totalPages() {
116
- return Math.ceil(this.total / this.pageSize)
117
- }
118
- },
119
- watch: {
120
- currentPage(newVal) {
121
- this.$emit('page-change', {
122
- page: newVal,
123
- pageSize: this.pageSize
124
- })
125
- }
126
- },
127
- methods: {
128
-
129
- // getPageConfig() {
130
- // pageConfig(this.sourceId).then((res: any) => {
131
- // this.pageData = res.data.ltmplConfig
132
-
133
- // getEnumer(this.pageData)
134
- // })
135
- // },
136
-
137
-
138
- prevPage() {
139
- if (this.currentPage > 1) {
140
- this.currentPage--
141
- }
142
- },
143
- nextPage() {
144
- if (this.currentPage < this.totalPages) {
145
- this.currentPage++
146
- }
147
- },
148
- sortColumn(col) {
149
- if (!this.sortable || !col.sortable) return
150
-
151
- if (this.sortField === col.key) {
152
- this.sortOrder = this.sortOrder === 'asc' ? 'desc' : 'asc'
153
- } else {
154
- this.sortField = col.key
155
- this.sortOrder = 'asc'
156
- }
157
-
158
- this.$emit('sort-change', {
159
- field: col.key,
160
- order: this.sortOrder
161
- })
162
- },
163
- getSummary(col) {
164
- if (col.summary === 'sum') {
165
- const sum = (this.data || []).reduce((sum, row) => sum + (Number(row[col.key]) || 0), 0)
166
- return isNaN(sum) ? '' : sum
167
- }
168
- return col.summaryText || ''
169
- }
170
- }
62
+ <script setup>
63
+ // columns: [
64
+ // { title: 'ID', key: 'id', width: '80px' },
65
+ // { title: '姓名', key: 'name', width: '80px', sortable: true },
66
+ // { title: '年龄', key: 'age', width: '80px', summary: 'sum', sortable: true },
67
+ // { title: '成绩', key: 'score', width: '80px', summary: 'sum', sortable: true },
68
+ // { title: '地址', key: 'address', width: '80px' }
69
+ // ]
70
+ import { onShow , onLoad } from "@dcloudio/uni-app"
71
+ import { ref, computed, watch, onMounted } from 'vue'
72
+ import wSearch from '../w-search/w-search.vue'
73
+ import { reportPageData, getPageKey, pageConfig, getEnum } from '../utils/apis/pageConfig'
74
+
75
+ const props = defineProps({
76
+ sourceId: {
77
+ type: String,
78
+ default: ''
79
+ },
80
+ mainCode: {
81
+ type: String,
82
+ default: ''
83
+ },
84
+ showSummary: {
85
+ type: Boolean,
86
+ default: false
87
+ },
88
+ sortable: {
89
+ type: Boolean,
90
+ default: false
91
+ },
92
+ pcolumns: {
93
+ type: Array,
94
+ required: false,
95
+ default: []
96
+ },
97
+ pdata: {
98
+ type: Array,
99
+ required: false,
100
+ default: []
101
+ },
102
+ pageSize: {
103
+ type: Number,
104
+ default: 10
105
+ },
106
+ total: {
107
+ type: Number,
108
+ required: false,
109
+ default: 0
110
+ },
111
+ loading: {
112
+ type: Boolean,
113
+ default: false
114
+ },
115
+ pagination: {
116
+ type: Boolean,
117
+ default: false
118
+ }
119
+ })
120
+
121
+ const emit = defineEmits(['page-change', 'sort-change'])
122
+
123
+ const currentPage = ref(1)
124
+ const bodyHeight = ref(1154)
125
+ const sortField = ref('')
126
+ const sortOrder = ref('asc')
127
+ const pageData = ref({})
128
+ const pageConfigs = ref({})
129
+ const columns = ref([])
130
+ const data = ref([])
131
+ const query = ref('')
132
+ const sourceId=ref('')
133
+ const totalPages = computed(() => {
134
+ return Math.ceil(props.total / props.pageSize)
135
+ })
136
+
137
+ const ccolumns = computed(() => {
138
+ let datas = columns.value || props.pcolumns
139
+ datas = columns.value.map((item) => {
140
+ return {
141
+ title: item.title,
142
+ key: item.sourceId,
143
+ summary: item.aggFunc,
144
+ width: "100px"
145
+ }
146
+ })
147
+ return datas
148
+ })
149
+
150
+ const cdata = computed(() => {
151
+ let datas = data.value || props.pdata
152
+ datas = data.value.map((item) => {
153
+ return {
154
+ ...item.fieldMap
155
+ }
156
+ })
157
+ return datas
158
+ })
159
+
160
+ watch(currentPage, (newVal) => {
161
+ emit('page-change', {
162
+ page: newVal,
163
+ pageSize: props.pageSize
164
+ })
165
+ })
166
+
167
+ onLoad((option) => {
168
+ console.log('kkkk')
169
+ sourceId.value=props.sourceId || option.sourceId
170
+ getpageConfig()
171
+ })
172
+
173
+ function getpageConfig() {
174
+ pageConfig(sourceId.value).then((res) => {
175
+ console.log(res.data.ltmplConfig)
176
+ pageConfigs.value = res.data.ltmplConfig
177
+ getPageData()
178
+ })
179
+ }
180
+
181
+ async function getPageData() {
182
+ const kres = await getPageKey(sourceId.value, null, query.value)
183
+ reportPageData(kres.data?.key).then((res) => {
184
+ pageData.value = res.data
185
+ data.value = res.data.entities
186
+ columns.value = res.data.columnConfigs
187
+ })
188
+ }
189
+
190
+ function search(e) {
191
+ query.value = e
192
+ getPageData()
193
+ }
194
+
195
+ function prevPage() {
196
+ if (currentPage.value > 1) {
197
+ currentPage.value--
198
+ }
199
+ }
200
+
201
+ function nextPage() {
202
+ if (currentPage.value < totalPages.value) {
203
+ currentPage.value++
204
+ }
205
+ }
206
+
207
+ function sortColumn(col) {
208
+ if (!props.sortable || !col.sortable) return
209
+
210
+ if (sortField.value === col.key) {
211
+ sortOrder.value = sortOrder.value === 'asc' ? 'desc' : 'asc'
212
+ } else {
213
+ sortField.value = col.key
214
+ sortOrder.value = 'asc'
215
+ }
216
+
217
+ emit('sort-change', {
218
+ field: col.key,
219
+ order: sortOrder.value
220
+ })
221
+ }
222
+
223
+ function getSummary(col) {
224
+ if (col.summary === 'sum') {
225
+ const sum = (cdata.value || []).reduce((sum, row) => sum + (Number(row[col.key])) || 0, 0)
226
+ return isNaN(sum) ? '' : sum
227
+ }
228
+ return col.summaryText || ''
171
229
  }
172
230
  </script>
173
231
 
174
232
  <style scoped>
175
233
  .smart-table-container {
176
234
  width: 100%;
177
- border-radius: 8px;
235
+ /* border-radius: 8px; */
178
236
  overflow: hidden;
179
237
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
180
238
  }
@@ -188,6 +246,7 @@
188
246
  }
189
247
 
190
248
  .header-cell {
249
+
191
250
  padding: 12px 16px;
192
251
  width: 200px;
193
252
  /* min-width: 200px; */
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <view>
3
3
  <view class="search-box">
4
- <view class="left">
4
+ <view class="left" v-if="props.criterias.length">
5
5
  <!-- <view class="search-icon">
6
6
  <wd-icon name="search" size="12px" ></wd-icon>
7
7
  </view> -->
@@ -99,7 +99,7 @@
99
99
 
100
100
  switch (item.extControlType) {
101
101
  case 'daterange':
102
- data[`${item.sourceId}`] = []
102
+ data[`${item.sourceId}`] =item.transDefaultValue ||""
103
103
  break;
104
104
  default:
105
105
  data[`${item.sourceId}`] = ''
@@ -191,9 +191,7 @@
191
191
 
192
192
 
193
193
  if (item.extControlType === 'daterange') {
194
- d = `c_${key}=${element?.map((mis : any) => {
195
- return dayjs(mis).format('YYYY-MM-DD')
196
- }).join('~')}`
194
+ d = `c_${key}=${element}`
197
195
  data.push(d)
198
196
  return
199
197
  }