w-ui-v1 1.0.27 → 1.0.29

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": "w-ui-v1",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "description": "w-ui",
5
5
  "author": "wgxshh",
6
6
  "license": "ISC",
@@ -54,9 +54,9 @@ export function editPageConfig(sourceId: string,code: string) {
54
54
 
55
55
 
56
56
  // 获取页面数据key
57
- export function getPageKey(sourceId: string, query: string='') {
57
+ export function getPageKey(sourceId: string,mainCode:string='', query: string='') {
58
58
  return request({
59
- url: `/v3/ltmpl/query/key?sourceId=${sourceId}&menuId=${sourceId}&${query}`,
59
+ url: `/v3/ltmpl/query/key?sourceId=${sourceId}&mainCode=${mainCode}&menuId=${sourceId}&${query}`,
60
60
  })
61
61
  }
62
62
 
@@ -102,4 +102,11 @@ export function customButtonSave(sourceId: string,codes:string, data: any) {
102
102
  ...data
103
103
  }
104
104
  })
105
+ }
106
+
107
+ //获取勾选数据
108
+ export function getSelectData(sourceId: string,codes:string) {
109
+ return request({
110
+ url: `/v3/field-group/data/selected?sourceId=${sourceId}&${codes}`,
111
+ })
105
112
  }
package/w-add/w-add.vue CHANGED
@@ -4,73 +4,64 @@
4
4
  <wd-loading />
5
5
  </view>
6
6
  <view v-else>
7
- <wd-collapse v-model="value" >
8
- <wd-collapse-item :title="item.title" :name="item.id" v-for="(item, index) in pageConf.groups" :key="index">
9
- <view
10
- v-if="item.type === 'fieldGroup'">
11
- <wd-form ref="form" :model="model">
12
- <wd-cell-group v-for="(subItem, subIndex) in item.fields" :key="subIndex">
13
- <wFromControl :subItem="subItem" :model="model" :Enumcolumn="Enumcolumn" v-model:model-value="model[subItem.id]"/>
14
- </wd-cell-group>
15
-
16
- </wd-form>
17
-
18
- </view>
19
- <view v-if="item.type === 'relation'">
20
- <view v-if="item.pointSourceId">
21
- <view class="row-add" v-if="item.buttons.includes('selectAdd')">
22
- <wd-button hairline type="info" size="small" icon="add"
23
- @click="selectrow(item)">选择</wd-button>
24
- </view>
7
+ <wd-collapse v-model="value">
8
+ <wd-collapse-item :title="item.title" :name="item.id" v-for="(item, index) in pageConf.groups"
9
+ :key="index">
10
+ <view v-if="item.type === 'fieldGroup'">
11
+ <wd-form ref="form" :model="model">
12
+ <wd-cell-group v-for="(subItem, subIndex) in item.fields" :key="subIndex">
13
+ <wFromControl :subItem="subItem" :model="model" :Enumcolumn="Enumcolumn"
14
+ v-model:model-value="model[subItem.id]" />
15
+ </wd-cell-group>
16
+
17
+ </wd-form>
18
+
25
19
  </view>
26
- <view v-else>
27
- <wd-card style="box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 17px 0px;margin: 0 0 10px 0;"
28
- v-for="(PItem, PIndex) in model[item.id]">
29
- <template #title>
30
- <view style="display: flex;justify-content: flex-end;">
31
- <wd-button size="small" type="icon" icon="delete"
32
- @click="remove(item.id, PIndex, item.title)"></wd-button>
33
- </view>
34
- </template>
35
- <wd-form :ref="item.id" :model="PItem">
36
- <wd-cell-group v-for="(subItem, subIndex) in item.fields" :key="subIndex">
37
- <wFromControl :subItem="subItem" :model="PItem" :Enumcolumn="Enumcolumn" v-model:model-value="PItem[subItem.id]"/>
38
- </wd-cell-group>
39
-
40
- </wd-form>
41
- <template #footer>
42
-
43
- </template>
44
- </wd-card>
20
+ <view v-if="item.type === 'relation'">
21
+ <view class="row-add">
22
+ <wd-button v-if="item.buttons.includes('selectAdd')" hairline type="info" size="small"
23
+ icon="add" @click="selectrow(item)">选择</wd-button>
24
+ <wd-button v-if="item.buttons.includes('dtmplAdd')" hairline type="info" size="small"
25
+ icon="add" @click="addrow(item.id)">新增</wd-button>
26
+ </view>
27
+
28
+ <!-- 卡片 -->
29
+ <view class="card-list" >
30
+ <w-card v-for="(subitem, index) in selectData[item.id]" :key="index" :car-index="index" :page="{
31
+ rowActions:item.rowActions||[],
32
+ buttons:item.buttons||[],
33
+ ractions:item.ractions||[],
34
+ columns:item.fields||[]
35
+ }"
36
+ :item-data="subitem" :source-id="item.pointSourceId" />
37
+ </view>
38
+
45
39
  <view class="row-add" v-if="item.buttons.includes('rowAdd')">
46
40
  <wd-button hairline type="info" size="small" icon="add"
47
41
  @click="addrow(item.id)">加一条</wd-button>
48
42
  </view>
49
43
  </view>
50
-
51
- </view>
52
-
53
-
54
- </wd-collapse-item>
55
- </wd-collapse>
56
- <view class="footer-button">
57
- <wd-button block @click="handleSubmit" icon="save">保存</wd-button>
44
+ </wd-collapse-item>
45
+ </wd-collapse>
46
+ <view class="footer-button">
47
+ <wd-button block @click="handleSubmit" icon="save">保存</wd-button>
48
+ </view>
58
49
  </view>
59
- </view>
60
50
  <wd-message-box />
61
51
  <wd-toast />
62
52
  </view>
63
53
  </template>
64
54
 
65
55
  <script setup lang="ts">
56
+ import wCard from '../w-card/w-card.vue'
66
57
  import wFromControl from '../w-form-control/w-form-control.vue'
67
- import WSelectTable from '../w-table/w-selectTable.vue';
68
- import { onLoad } from '@dcloudio/uni-app'
58
+ import { onLoad, onUnload } from '@dcloudio/uni-app'
69
59
  import { ref, defineProps, reactive } from 'vue';
70
60
  import {
71
61
  addPageConfig,
72
62
  getEnum,
73
- addPageDataSave
63
+ addPageDataSave,
64
+ getSelectData
74
65
  } from '../utils/apis/pageConfig'
75
66
  import { useMessage } from 'wot-design-uni'
76
67
  import { useToast } from 'wot-design-uni'
@@ -91,9 +82,12 @@ const pageConf = ref({ groups: [] })
91
82
  const form = ref()//基本数据表单
92
83
  //表单数据
93
84
  const model = ref({})
94
- const modelsRef={
95
-
85
+ const relationID = ref('')
86
+ const modelsRef = {
87
+
96
88
  }
89
+
90
+ const checkboxvalue = ref([])
97
91
  const loading = ref(false)
98
92
  const value = ref([])
99
93
  const Enumcolumn = ref({})
@@ -101,6 +95,21 @@ const pointSourceId = ref('')
101
95
  onLoad((option: any) => {
102
96
  sourceId.value = props.sourceId || option.sourceId
103
97
  getPageConfig()
98
+
99
+ //监听勾选列表页面事件
100
+ uni.$on('getCheckData', function (data: any) {
101
+ checkboxvalue.value = data.checkData
102
+ //获取勾选数据
103
+ let codes = ''
104
+ checkboxvalue.value.forEach((item: any) => {
105
+ codes += `codes=${item}&`
106
+ })
107
+ getSelectDataPxoy(codes)
108
+ })
109
+ })
110
+ onUnload(() => {
111
+ // 取消监听勾选列表页面事件
112
+ uni.$off('getCheckData')
104
113
  })
105
114
 
106
115
  function getPageConfig() {
@@ -118,6 +127,7 @@ function getPageConfig() {
118
127
  // t[0][subItem.id] = subItem.defaultValue || ''
119
128
  // })
120
129
  relation[item.id] = t
130
+ relation[`${item.id}.$$flag$$`] = true
121
131
  }
122
132
  if (item.type === 'fieldGroup') {
123
133
 
@@ -167,21 +177,21 @@ async function handleSubmit() {
167
177
  message: '保存中...',
168
178
  duration: 0
169
179
  })
170
-
180
+
171
181
  try {
172
182
  const res = await addPageDataSave(sourceId.value, model.value)
173
- if (res.data.status==='success'){
183
+ if (res.data.status === 'success') {
174
184
  toast.success("保存成功")
175
- uni.navigateBack()
176
- }else{
177
- toast.error(res.data.message||'保存失败"')
185
+ uni.navigateBack()
186
+ } else {
187
+ toast.error(res.data.message || '保存失败"')
178
188
  }
179
-
189
+
180
190
  } catch (error) {
181
191
  toast.error(error)
182
192
  }
183
193
 
184
-
194
+
185
195
  }
186
196
  })
187
197
  .catch((error) => {
@@ -190,13 +200,21 @@ async function handleSubmit() {
190
200
 
191
201
  }
192
202
 
193
- //选择数据
203
+ //跳转勾选页面数据
194
204
  function selectrow(item: any) {
205
+ relationID.value = item.id
195
206
  pointSourceId.value = item.pointSourceId
196
207
  uni.navigateTo({
197
208
  url: `/pages/selectTable/selectTable?sourceId=${pointSourceId.value}`
198
209
  })
199
210
  }
211
+ const selectData = ref({})
212
+ //获取勾选数据
213
+ async function getSelectDataPxoy(codes: string) {
214
+ const res = await getSelectData(relationID.value, codes)
215
+ selectData.value[relationID.value] = res.data.entities
216
+ }
217
+
200
218
 
201
219
  //新加一行
202
220
  function addrow(key: any) {
@@ -47,7 +47,7 @@ export function getValue(content: any, title: any): any {
47
47
  }
48
48
 
49
49
  //文件链接
50
- if (obj.base?.path && (obj.base?.type.includes('docx')|| obj.base?.type.includes('txt'))) {
50
+ if (obj.base?.path && (obj.base?.type.includes('docx')|| obj.base?.type.includes('txt')|| obj.base?.type.includes('dat'))) {
51
51
 
52
52
  return {
53
53
  url: `${baseUrl}/v3/files${obj.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}`,
package/w-card/w-card.vue CHANGED
@@ -31,6 +31,41 @@ const props = defineProps({
31
31
  },
32
32
  })
33
33
 
34
+ //更多按钮
35
+ const moreBtns = computed(() => {
36
+ let data = []
37
+ props.page.rowActions?.forEach((element: any) => {
38
+ if (element.preposes[0]) {
39
+ if (element.preposes[0].transDefaultValue.includes(props.itemData.fieldMap[element.preposes[0].id])) {
40
+ data.push({
41
+ actionType: "submit",
42
+ name: element.title,
43
+ color: '#4D81F1',
44
+ ...element
45
+ })
46
+ }
47
+ } else {
48
+ data.push({
49
+ actionType: "submit",
50
+ name: element.title,
51
+ color: '#4D81F1',
52
+ ...element
53
+ })
54
+ }
55
+ });
56
+
57
+ props.page.ractions?.forEach((item: any) => {
58
+ data.push({
59
+ actionType:"openPage",
60
+ name: item.title,
61
+ color: '#4D81F1',
62
+ ...item
63
+ })
64
+ })
65
+
66
+ return data
67
+ })
68
+
34
69
  // 处理单项数据、配置
35
70
  const items = computed(() => {
36
71
  return props.page.columns?.filter((item: any) => {
@@ -42,6 +77,7 @@ const items = computed(() => {
42
77
  }).map((item: any) => {
43
78
  return {
44
79
  title: item.title,
80
+ controlType: item.controlType,
45
81
  content: getValue(props.itemData?.fieldMap[item.id], item.title),
46
82
  data: props.itemData?.fieldMap[item.id],
47
83
  id: item.id,
@@ -52,8 +88,8 @@ const items = computed(() => {
52
88
  }) || []
53
89
  })
54
90
 
55
- const wFormMessageBoxRef= ref()
56
-
91
+ const wFormMessageBoxRef = ref()
92
+ const showMoreButns = ref(false)
57
93
  const isExpanded = ref(false)
58
94
  const defaultVisible = 4 // 默认显示行数量
59
95
 
@@ -97,13 +133,17 @@ function goto(type: string, item: any = {}, subItem: string = '') {
97
133
  url: `/pages/edit/edit?sourceId=${props.sourceId}&code=${props.itemData.code}`,
98
134
  })
99
135
  break
136
+ case 'openPage':
137
+ uni.navigateTo({
138
+ url: `/pages/table/table?sourceId=${item.id}&pageTitle=${item.title}&mainCode=${props.itemData.code}`,
139
+ })
140
+ break
100
141
  }
101
142
 
102
143
  }
103
144
 
104
145
  //删除
105
146
  const dele = () => {
106
- console.log('delete');
107
147
  message
108
148
  .confirm({
109
149
  msg: '确定删除吗?',
@@ -123,7 +163,19 @@ const dele = () => {
123
163
 
124
164
  }
125
165
 
126
- // 自定义按钮操作
166
+ //更多按钮点击事件
167
+ const moreBtnsSelect = (item: any) => {
168
+ switch (item.item.actionType) {
169
+ case 'submit':
170
+ actionBtn(item.item)
171
+ break
172
+ case 'openPage':
173
+ goto(item.item.actionType, item.item)
174
+ break
175
+ }
176
+ }
177
+
178
+ // 更多按钮操作
127
179
  const actionBtn = (item: any) => {
128
180
  wFormMessageBoxRef.value.openFormMessageBox(item)
129
181
  }
@@ -156,9 +208,13 @@ const actionBtn = (item: any) => {
156
208
  <wd-text type="primary" @click="downloadFile(item.content.url)" :text="item.content?.name" />
157
209
  </view>
158
210
 
159
- <audio v-else-if="item.content?.type === '音频'" :src="item.content?.url" :author="item.content?.author"
211
+ <audio style="width: 50px;" v-else-if="item.content?.type === '音频'" :src="item.content?.url" :author="item.content?.author"
160
212
  :name="item.content?.name" controls></audio>
161
213
 
214
+ <!-- <audio style="width: 50px;" v-else-if="item.controlType==='file'" :src="item.content"
215
+ controls></audio> -->
216
+
217
+
162
218
  <view v-else class="value">
163
219
  {{ item.content }}
164
220
  </view>
@@ -172,12 +228,6 @@ const actionBtn = (item: any) => {
172
228
  </view>
173
229
  <template #footer>
174
230
  <view class="btns-box">
175
- <view v-if="props.page.rowActions" v-for="(bitem, index) in props.page.rowActions" :key="index">
176
- <wd-button :type="bitem.buttonType === 'dashed' ? 'info' : 'warning'" size="small" plain @click="actionBtn(bitem)"
177
- v-if="bitem.preposes[0].transDefaultValue.includes(props.itemData?.fieldMap[bitem.preposes[0].id])">
178
- {{ bitem.title }}
179
- </wd-button>
180
- </view>
181
231
  <wd-button size="small" class="btn" plain v-if="props.page.buttons.includes('detail')" @click="goto('detail')">
182
232
  详情
183
233
  </wd-button>
@@ -189,12 +239,19 @@ const actionBtn = (item: any) => {
189
239
  v-if="props.page.buttons.includes('singleDelete')">
190
240
  删除
191
241
  </wd-button>
242
+ <view v-if="moreBtns.length > 0">
243
+ <wd-button type='info' size="small" plain @click="showMoreButns = true">
244
+ 更多
245
+ </wd-button>
246
+ </view>
192
247
  </view>
193
248
  </template>
194
249
  </wd-card>
195
250
  <wd-toast />
196
251
  <wd-message-box />
197
- <WFormMessageBox ref="wFormMessageBoxRef" :itemData="props.itemData" @refresh="emits('refresh')"/>
252
+ <WFormMessageBox ref="wFormMessageBoxRef" :itemData="props.itemData" @refresh="emits('refresh')" />
253
+ <!-- 更多按钮 -->
254
+ <wd-action-sheet v-model="showMoreButns" :actions="moreBtns" @select="moreBtnsSelect" />
198
255
  </template>
199
256
 
200
257
  <style lang="scss" scoped>
@@ -1,14 +1,14 @@
1
1
  <script lang="ts">
2
2
  //在自定义组件中使用 Wot Design Uni 组件时,需开启styleIsolation: 'shared'选项覆盖样式
3
3
  export default {
4
- options: {
5
- styleIsolation: 'shared'//使css :deep()生效
6
- }
4
+ options: {
5
+ styleIsolation: 'shared'//使css :deep()生效
6
+ }
7
7
  }
8
8
  </script>
9
9
  <script setup lang="ts">
10
10
  import { onLoad } from '@dcloudio/uni-app'
11
- import { getValue ,downloadFile} from '../w-card/utils/utils'
11
+ import { getValue, downloadFile } from '../w-card/utils/utils'
12
12
  import {
13
13
  computed,
14
14
  ref,
@@ -73,40 +73,39 @@ function goto(PItem: any, item: any) {
73
73
  <wd-loading />
74
74
  </view>
75
75
  <wd-collapse v-model="value" v-else>
76
- <wd-collapse-item custom-body-class="collapse-custom-class" :title="item.title" :name="item.id" v-for="(item, index) in pageConf.groups" :key="index">
77
-
76
+ <wd-collapse-item custom-body-class="collapse-custom-class" :title="item.title" :name="item.id"
77
+ v-for="(item, index) in pageConf.groups" :key="index">
78
+
78
79
  <wd-card title=" " v-if="item.type === 'fieldGroup'" custom-class="card-custom-class">
79
80
  <view v-for="(subItem, subIndex) in item.fields" :key='subIndex' style='margin-bottom: 8px;'>
80
- <wd-row v-if="!subItem.hidden">
81
- <wd-col :span="6">
82
- <view class="label">
83
- {{ subItem.title }}:
84
- </view>
85
- </wd-col>
86
- <wd-col :span="18">
87
- <wd-img
88
- v-if="getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.type === '图片'"
89
- width="100rpx" height="100rpx"
90
- :src="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).url"
91
- :enable-preview="true" />
92
- <view
93
- v-else-if="getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.type === '文件'"
94
- class="value">
95
- <wd-text type="primary"
96
- @click="downloadFile(getValue(pageData.fieldMap[subItem.sourceId], subItem.title).url)"
97
- :text="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).name" />
98
- </view>
99
- <audio
100
- v-else-if="getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.type === '音频'"
101
- :src="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).url"
102
- :author="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).author"
103
- :name="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).name"
104
- controls></audio>
105
- <view v-else class="value">
106
- {{ getValue(pageData.fieldMap[subItem.sourceId], subItem.title) }}
107
- </view>
108
- </wd-col>
109
- </wd-row>
81
+ <view v-if="!subItem.hidden" class="row">
82
+
83
+ <view class="label">
84
+ {{ subItem.title }}:
85
+ </view>
86
+
87
+ <wd-img v-if="getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.type === '图片'"
88
+ width="100rpx" height="100rpx"
89
+ :src="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).url"
90
+ :enable-preview="true" />
91
+ <view
92
+ v-else-if="getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.type === '文件'"
93
+ class="value">
94
+ <wd-text type="primary"
95
+ @click="downloadFile(getValue(pageData.fieldMap[subItem.sourceId], subItem.title).url)"
96
+ :text="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).name" />
97
+ </view>
98
+ <audio
99
+ v-else-if="getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.type === '音频'"
100
+ :src="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).url"
101
+ :author="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).author"
102
+ :name="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).name"
103
+ controls></audio>
104
+ <view v-else class="value">
105
+ {{ getValue(pageData.fieldMap[subItem.sourceId], subItem.title) }}
106
+ </view>
107
+
108
+ </view>
110
109
  </view>
111
110
 
112
111
  <template #footer>
@@ -114,17 +113,17 @@ function goto(PItem: any, item: any) {
114
113
  v-if="item.buttons.includes('detail')">详情</wd-button>
115
114
  </template>
116
115
  </wd-card>
117
-
116
+
118
117
  <view v-if="item.type === 'relation'">
119
- <wd-card custom-class="card-custom-class" title=" " v-for="(PItem, PIndex) in pageData.arrayMap[item.id]" :key="PIndex">
118
+ <wd-card custom-class="card-custom-class-relation" title=" "
119
+ v-for="(PItem, PIndex) in pageData.arrayMap[item.id]" :key="PIndex">
120
120
  <view v-for="(subItem, subIndex) in item.fields" :key='subIndex' style='margin-bottom: 8px;'>
121
- <wd-row v-if="!subItem.hidden">
122
- <wd-col :span="6">
121
+ <view v-if="!subItem.hidden" class="row">
122
+
123
123
  <view class="label">
124
124
  {{ subItem.title }}:
125
125
  </view>
126
- </wd-col>
127
- <wd-col :span="18">
126
+
128
127
  <wd-img
129
128
  v-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '图片'"
130
129
  width="100rpx" height="100rpx"
@@ -146,8 +145,8 @@ function goto(PItem: any, item: any) {
146
145
  <view v-else class="value">
147
146
  {{ getValue(PItem.fieldMap[subItem.sourceId], subItem.title) }}
148
147
  </view>
149
- </wd-col>
150
- </wd-row>
148
+
149
+ </view>
151
150
  </view>
152
151
 
153
152
  <template #footer>
@@ -164,24 +163,33 @@ function goto(PItem: any, item: any) {
164
163
  </template>
165
164
 
166
165
  <style scoped lang="scss">
167
- .label {
168
- //文字换行
169
- white-space: normal;
170
- word-break: break-all;
171
- }
166
+ .row {
167
+ display: flex;
168
+
169
+ .label {
170
+ //文字换行
171
+ white-space: normal;
172
+ word-break: break-all;
173
+ margin-right: 20rpx;
174
+ }
172
175
 
173
- .value {
174
- //文字换行
175
- white-space: normal;
176
- word-break: break-all;
177
- color: #333;
176
+ .value {
177
+ //文字换行
178
+ white-space: normal;
179
+ word-break: break-all;
180
+ color: #333;
181
+ }
178
182
  }
179
183
 
180
- :deep(.card-custom-class){
184
+
185
+ :deep(.card-custom-class) {
181
186
  margin: 0 !important;
182
187
  }
188
+ :deep(.card-custom-class-relation){
189
+ margin: 0 0 8px 0 !important;
190
+ }
183
191
 
184
- :deep(.collapse-custom-class){
185
- background-color:#F6F7FB ;
192
+ :deep(.collapse-custom-class) {
193
+ background-color: #F6F7FB;
186
194
  }
187
195
  </style>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <view>
3
- <wd-message-box selector="wd-message-box-slot">
3
+ <wd-message-box selector="wd-message-box-slot" custom-class="wd-message-box-slot">
4
4
  <wd-form ref="form" :model="model">
5
5
  <wFromControl :subItem="subItem" v-for="(subItem,subIndex) in page.formItem" :key="subIndex" :model="model" :Enumcolumn="Enumcolumn"
6
6
  v-model:model-value="model[subItem.id]" />
@@ -10,6 +10,14 @@
10
10
  </view>
11
11
  </template>
12
12
 
13
+ <script lang="ts">
14
+ //在自定义组件中使用 Wot Design Uni 组件时,需开启styleIsolation: 'shared'选项覆盖样式
15
+ export default {
16
+ options: {
17
+ styleIsolation: 'shared'//使css :deep()生效
18
+ }
19
+ }
20
+ </script>
13
21
  <script setup lang="ts">
14
22
  import wFromControl from '../w-form-control/w-form-control.vue'
15
23
  import {reactive,ref,defineProps,defineExpose,computed,watch,defineEmits} from 'vue'
@@ -45,7 +53,6 @@ const props=defineProps({
45
53
  })
46
54
 
47
55
  const page=computed(()=>{
48
-
49
56
  return {
50
57
  formItem: pageConf.value.writes,
51
58
  sourceId: pageConf.value.id
@@ -55,7 +62,7 @@ const page=computed(()=>{
55
62
  watch(page,(value)=>{
56
63
  if (!value) return
57
64
  value.formItem.forEach((item: any) => {
58
- model[item.id] = item.defaultValue || ''
65
+ model[item.id] =props.itemData.fieldMap[item.id] || ''
59
66
  })
60
67
  getEnumer()
61
68
  })
@@ -103,4 +110,11 @@ defineExpose({
103
110
  })
104
111
  </script>
105
112
 
106
- <style scoped lang="scss"></style>
113
+ <style scoped lang="scss">
114
+ :deep(.wd-message-box-slot){
115
+ width: 95vw !important;
116
+ }
117
+ :deep( .wd-message-box-slot .wd-message-box__flex){
118
+ justify-content: space-between !important;
119
+ }
120
+ </style>
@@ -9,7 +9,7 @@
9
9
  <wd-drop-menu-item ref="dropMenu" title="搜索" @opened="handleOpened">
10
10
  <view v-for="(item, index) in props.criterias" :key="index">
11
11
  <wSelectPicker :model-value="searchData[item.sourceId] ? searchData[item.sourceId].value : ''"
12
- v-if="item.extControlType === 'relselectvalue'" type="radio"
12
+ v-if="item.extControlType === 'relselectvalue' || item.extControlType === 'entity-select'" type="radio"
13
13
  @confirm="(e) => { searchData[item.sourceId] = e.selectedItems }" :label="item.title"
14
14
  :placeholder="`请选择${item.title}`" :source-id="item.sourceId" filterable />
15
15
  <wd-input v-else-if="item.extControlType === 'text'" type="text" :label="item.title"
@@ -28,8 +28,8 @@
28
28
  :label="item.title" v-model="searchData[item.sourceId]" clearable />
29
29
  </view>
30
30
 
31
- <wd-input v-else type="text" :label="item.title"
32
- v-model="searchData[item.sourceId]" :placeholder="`请输入${item.title}`" clearable />
31
+ <wd-input v-else type="text" :label="item.title" v-model="searchData[item.sourceId]"
32
+ :placeholder="`请输入${item.title}`" clearable />
33
33
  </view>
34
34
  <view class="search-btn">
35
35
  <wd-button size="small" icon="refresh" @click="clear" type="info">重置</wd-button>
@@ -76,9 +76,6 @@ onBeforeMount(() => {
76
76
  case 'daterange':
77
77
  data[`${item.sourceId}`] = []
78
78
  break;
79
- case 'relselectvalue':
80
- data[`${item.sourceId}`] = ''
81
- break;
82
79
  default:
83
80
  data[`${item.sourceId}`] = ''
84
81
  }
@@ -116,6 +113,7 @@ const search = () => {
116
113
  d = `c_${key}=${dayjs(element).format('YYYY-MM-DD HH')}`
117
114
  data.push(d)
118
115
  break;
116
+ case 'entity-select':
119
117
  case 'relselectvalue':
120
118
  console.log(element)
121
119
  d = `c_${key}=${element.label}`
@@ -149,7 +147,7 @@ const clear = () => {
149
147
  async function getEnumer() {
150
148
  let params = []
151
149
  props.criterias.forEach((item: any) => {
152
- if (item.controlType === 'select') {
150
+ if (item.extControlType === 'select') {
153
151
  params.push(`mstrucIds=${item.mstrucId}`)
154
152
  }
155
153
 
@@ -26,6 +26,7 @@ const props = defineProps({
26
26
  const query = ref('')
27
27
  const sourceId = ref('')
28
28
  const radiovalue = ref()
29
+ const checkboxvalue = ref([])
29
30
  const pageData = ref<{
30
31
  criterias: []
31
32
  buttons: string[]
@@ -44,6 +45,33 @@ watch(() => props.sourceId, (value) => {
44
45
  immediate: false
45
46
  })
46
47
 
48
+ //选择的数据
49
+ const checkData = computed(() => {
50
+ let data=[]
51
+ checkboxvalue.value.forEach((item:any)=>{
52
+ let it=dataList.value.find((subitem:any)=>{
53
+
54
+ return subitem.code === item
55
+ })
56
+ if(it){
57
+ data.push({
58
+ label:it.fieldMap[pageData.value.primaryColumn.id],
59
+ value:it.code
60
+ })
61
+ }
62
+ })
63
+
64
+ return data
65
+
66
+ })
67
+
68
+ //关闭tag
69
+ function handletagClose(item: any) {
70
+ checkboxvalue.value = checkboxvalue.value.filter((subitem: any) => {
71
+ return subitem !== item.value
72
+ })
73
+ }
74
+
47
75
  // 获取页面配置
48
76
  function getPageConfig() {
49
77
  selectPageConfig(sourceId.value).then((res: any) => {
@@ -81,10 +109,10 @@ async function queryList(pageNo: number, pageSize: number) {
81
109
  const key = await getPageKey(sourceId.value, query.value)// 获取key
82
110
  const data = await getPageData(key.data?.key, pageNo, pageSize)// 获取数据
83
111
  // const count = await getPageTotal(key.data?.key)// 获取总数
84
- paging.value.complete(data.data.entities)
112
+ paging.value.complete && paging.value.complete(data.data.entities)
85
113
  }
86
114
  catch (error) {
87
- paging.value.complete(false)
115
+ paging.value.complete && paging.value.complete(false)
88
116
  console.error(error)
89
117
  }
90
118
  }
@@ -95,18 +123,18 @@ function add() {
95
123
  url: `/pages/add/add?sourceId=${sourceId.value}`,
96
124
  })
97
125
  }
126
+
98
127
  // 点击确定按钮
99
128
  function SubmitHanld() {
100
- const index = radiovalue.value
101
- if (index === undefined) {
102
- uni.showToast({
103
- title: '请选择一条数据',
104
- icon: 'none'
105
- })
106
- return
107
- }
108
- const item = dataList.value[index]
109
- uni.setStorageSync('selectItem', item)
129
+ uni.navigateBack({
130
+ success:()=>{
131
+ uni.$emit('getCheckData',{checkData: checkboxvalue.value})
132
+ }
133
+ })
134
+ }
135
+
136
+ //点击取消按钮
137
+ function handleCansle() {
110
138
  uni.navigateBack()
111
139
  }
112
140
 
@@ -124,25 +152,32 @@ function SubmitHanld() {
124
152
  <wd-button v-if="pageData.buttons.includes('dtmplAdd')" type="icon" icon="add" @click="add" />
125
153
  </view>
126
154
  <view class="button-container">
127
- <wd-button type="info" size="small">关闭</wd-button>
128
- <wd-button size="small" @click="SubmitHanld">确定</wd-button>
155
+ <wd-button type="info" size="small" @click="handleCansle">取消</wd-button>
156
+ <wd-button size="small" @click="SubmitHanld" >确定</wd-button>
129
157
  </view>
130
158
  </view>
131
-
159
+ <!-- 选择的数据 -->
160
+ <view class="select-container">
161
+ <wd-tag @close="handletagClose(item)" closable round type="primary" v-for="(item, index) in checkData" :key="index">{{ item.label }}</wd-tag>
162
+ </view>
132
163
  </template>
133
164
  <!-- 卡片 -->
134
- <view v-for="(item, index) in dataList" :key="index" class="card-container">
135
- <view style="background-color: #fff;">
136
- <view style="padding:10px 0 0 30px;" @click="radiovalue = index">
137
- <wd-radio-group v-model="radiovalue" shape="dot" inline>
138
- <wd-radio :value="index"></wd-radio>
139
- </wd-radio-group>
165
+ <view class="card-container">
166
+ <!-- 复选框 -->
167
+ <wd-checkbox-group v-model="checkboxvalue">
168
+ <view v-for="(item, index) in dataList" :key="index">
169
+ <view >
170
+ <view style="padding:10px 0 0 30px;">
171
+ <wd-checkbox :modelValue="item.code"></wd-checkbox>
172
+ </view>
173
+ <w-card style="background: none;" :car-index="index" :page="pageData" :item-data="item"
174
+ :source-id="sourceId" />
175
+ </view>
140
176
  </view>
141
- <w-card style="background: none;" :car-index="index" :page="pageData" :item-data="item" :source-id="sourceId" />
142
- </view>
143
-
177
+ </wd-checkbox-group>
144
178
  </view>
145
179
 
180
+
146
181
  </z-paging>
147
182
  </template>
148
183
 
@@ -153,9 +188,21 @@ function SubmitHanld() {
153
188
  justify-content: space-between;
154
189
  background-color: #fff;
155
190
  padding: 10px;
156
- .button-container{
191
+
192
+ .button-container {
157
193
  display: flex;
158
194
  gap: 10px;
159
195
  }
160
196
  }
197
+ .select-container{
198
+ display: flex;
199
+ flex-wrap: wrap;
200
+ gap: 5px;
201
+ padding:0 10px;
202
+ }
203
+
204
+ .card-container {
205
+ padding:10px;
206
+ background-color: #F6F7FB;
207
+ }
161
208
  </style>
@@ -21,16 +21,22 @@ const props = defineProps({
21
21
  sourceId: {
22
22
  type: String,
23
23
  default: ''
24
+ },
25
+ mainCode:{
26
+ type: String,
27
+ default: ''
24
28
  }
25
29
  })
26
30
  const query = ref('')
27
31
  const sourceId = ref('')
32
+ const mainCode = ref('')
28
33
  const pageData = ref<{
29
34
  criterias: []
30
35
  buttons: string[]
31
36
  }>({ criterias: [], buttons: [] })
32
37
  onLoad((option: any) => {
33
38
  sourceId.value = props.sourceId || option.sourceId
39
+ mainCode.value = props.mainCode ||option.mainCode
34
40
  uni.setNavigationBarTitle({ title: option.pageTitle })
35
41
 
36
42
  })
@@ -81,13 +87,13 @@ async function queryList(pageNo: number, pageSize: number) {
81
87
  // })
82
88
  try {
83
89
 
84
- const key = await getPageKey(sourceId.value, query.value)// 获取key
90
+ const key = await getPageKey(sourceId.value, mainCode.value,query.value)// 获取key
85
91
  const data = await getPageData(key.data?.key, pageNo, pageSize)// 获取数据
86
92
  // const count = await getPageTotal(key.data?.key)// 获取总数
87
- paging.value.complete(data.data.entities)
93
+ paging.value.complete&&paging.value.complete(data.data.entities)
88
94
  }
89
95
  catch (error) {
90
- paging.value&&paging.value.complete(false)
96
+ paging.value.complete&&paging.value&&paging.value.complete(false)
91
97
  console.error(error)
92
98
  }
93
99
  }